|
From: Chris H. <ch...@op...> - 2006-01-06 20:57:56
|
Note that in the past couple days a nice javascript scalebar has emerged. See: https://sourceforge.net/mailarchive/forum.php?thread_id=3D9394832&forum_i= d=3D475 If you're using mapbuilder it could be quite easy to get in. And the javascript code is available if you're using anything else. After you've got things working, it would be great if you could put something up in the User Experiences - how you got a scalebar working would be great, or anything else you learned that wasn't quite in the docs. It can be informal. And do submit the patch for geoserver if you've got it creating a scalebar correctly. best regards, Chris Quoting todd runstein <tod...@ya...>: > Chris, > > Thank you! That code was exactly what I needed! I > don't have the actual scalebar working yet, but at > least I've got an accurate measurement. Once I get > the image to generate correctly, I'll post the code as > you suggest. > > Thanks again! > > Todd > > --- Chris Holmes <ch...@op...> wrote: > > > I would love to get a scalebar in GeoServer, if you > > get this working > > please do contribute the code back, just make a bug > > report and attach > > the code you wrote to the issue. We can probably > > figure out how to > > make a UI so it's easier for others to set. > > > > As for the code, I personally have little idea, but > > our udig compatriots > > have a working scalebar, so in true open source > > fashion I'd just take a > > gander at what they did. Jody gave this link: > > > http://svn.geotools.org/udig/trunk/plugins/net.refractions.udig.printing.= ui/src/net/refractions/udig/printing/ui/ScalebarMapGraphic.java > > which looks like it might contain what you need. If > > you have further > > questions on how it works just ask the udig list, > > and I'm sure they'll > > help you out. The gt2 list may also be helpful. > > > > best regards, > > > > Chris > > > > Quoting todd runstein <tod...@ya...>: > > > > > I'm trying to create something similar to the > > > "scalebar" found in MapServer. I'm using brute > > force > > > to modify the image generated in the produceMap > > method > > > in > > > > > > org.vfny.geoserver.wms.responses.DefaultRasterMapProducer, > > > but am having trouble getting a valid measurement. > > > > > > Here's the code I'm using (starting at around line > > > 260): > > > > > > if (map=3D=3Dnull || > > > map.getCoordinateReferenceSystem()=3D=3Dnull){ > > > System.out.println("Could not create a > > > measurement"); > > > }else{ > > > DefaultEllipsoid e =3D (DefaultEllipsoid) > > > > > > CRSUtilities.getHeadGeoEllipsoid(map.getCoordinateReferenceSystem()); > > > Unit unit =3D e.getAxisUnit(); > > > Unit target =3D SI.METER; > > > Converter c =3D unit.getConverterTo(target); > > > double d =3D > > > c.convert(map.getAreaOfInterest().getWidth()); > > > > > > graphic.setColor(Color.BLACK); > > > if (paintArea.width>200) { > > > graphic.drawString("Distance may be " + > > > d,0,paintArea.height); > > > } > > > } > > > > > > When the map first loads (using MapBuilder), it > > tells > > > me that the AreaOfInterest is approximately 1.09 > > > meters, however it's showing all of Multnomah > > County, > > > Oregon (not sure what the total width is, but it's > > > certainly larger than what is shown). Zooming in > > > changes the distance displayed in (what appears to > > be) > > > the correct proportion, though it is still > > woefully > > > short. > > > > > > I'm using Tiger data (obtained through a > > ShapeFile) > > > loaded into Postgis with shp2pgsql and am using > > > EPSG:4326. I assume the Ellipsoid I'm retrieving > > > isn't really what I want, or the > > > getAreaOfInterest().getWidth() isn't returning > > > anything that can be reliably converted. Then > > again, > > > maybe it's something else entirely. > > > > > > Any help would be greatly appreciated! > > > > > > Todd > > > > > > > > > The only "dumb question" is the one you were too > > afraid to ask. > > > ________________________________________ > > > Check out RouteRuler - Free software for runners, > > cyclists, walkers, > > > etc. > > > http://routeruler.sourceforge.net > > > ________________________________________ > > > Get a handle on your data with "pocOLAP", the > > "little" OLAP project > > > http://pocolap.sourceforge.net > > > ________________________________________ > > > > > > > > > > > > > > > __________________________________ > > > Yahoo! for Good - Make a difference this year. > > > http://brand.yahoo.com/cybergivingweek2005/ > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: Splunk Inc. Do > > you grep through > > > log files > > > for problems? Stop! Download the new AJAX search > > engine that makes > > > searching your log files as easy as surfing the > > web. DOWNLOAD > > > SPLUNK! > > > > > > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > > > _______________________________________________ > > > Geoserver-users mailing list > > > Geo...@li... > > > > > > https://lists.sourceforge.net/lists/listinfo/geoserver-users > > > > > > > > > > > > > > ---------------------------------------------------------- > > This mail sent through IMP: > > https://webmail.limegroup.com/ > > > > > The only "dumb question" is the one you were too afraid to ask. > ________________________________________ > Check out RouteRuler - Free software for runners, cyclists, walkers, > etc. > http://routeruler.sourceforge.net > ________________________________________ > Get a handle on your data with "pocOLAP", the "little" OLAP project > http://pocolap.sourceforge.net > ________________________________________ > > > > __________________________________________ > Yahoo! DSL =96 Something to write home about. > Just $16.99/mo. or less. > dsl.yahoo.com > ---------------------------------------------------------- This mail sent through IMP: https://webmail.limegroup.com/ |