Hi, Another option to do what you want is to use a GIS application. It is not always as fun as programming, but may be faster in this case.
uDig (http://udig.refractions.net/confluence/display/UDIG/Home) is built using geotools and the newest version is looking very nice. You can load a shapefile, and then change the projection of the map displaying the shapefile. The shapefile coordinate reference system (CRS) (aka projection) comes from the shapefile prj file. If your shapefile does not have one, you can create one called <shapefile name>.prj. In this file you need one line with a well known text (WKT) definition of the shapefile's CRS. See the geotools coordinate transformation tutorial ( http://www.geotools.org/display/GEOTOOLS/Coordinate+Transformation +Services+for+Geotools+2.1 ) for a link to some WKT examples. If you do not know your shapefile's projection, you may be able to make an educated guess. If x and y coordinates are +-180 and +- 90, respectively, it might just be a simple geographic CRS. Else, depending on where the data is, it might use a transverse mecator (ie UTM) or lambert or albers projection. In uDig, you can change the CRS for the map. Select the map and then click the CRS button at the bottom of the application. uDig defaults to a WGS 84 geographic CRS, but you can chose different ones from a list or input a custom one using WKT. If uDig knows the source CRS for the data (ie there is a valid *.prj file) then it will reproject the data on the map. If it does not know the source CRS, it will not project the data, and will just display the coordinates as is. Anyway, even if you want to program this, it will be worthwhile to play with changing projections in uDig first. Rueben On Fri, 2005-16-12 at 14:58 +0100, Frankie Bollaert wrote: > I am just getting started with GeoTools and GIS in general. My > background is that of a java developer. So forgive me if my questions > seem ignorant, but I am looking for some guidance. > > So far I have managed to convert vmap0 data into ESRI shape files and > to display those by adapting the Spearfish example. So I have a nice > little map of the world. My next step would be to make the map a > little prettier by giving all the countries a different colour and > displaying the names of the countries. > > What I am also wondering about are projections. I am not sure what > projection my map is using, but I would like to experiment with > different projections. So far I have found some documentation about > creating a custom projection, but no information about applying a > projection to a displayed map. > > Are there some examples available, or could somebody describe the > concrete (small) steps how to achieve this? > > Thank you, > Frankie > > > ------------------------------------------------------- > 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_idv37&alloc_id865&op=click > _______________________________________________ > Geotools-gt2-users mailing list > Geotools-gt2-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------- 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=7637&alloc_id=16865&op=click _______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users