ShapeFileDatastore has a method that you can use to "force" a CoordinateReferenceSystem at runtime - you can always stuff WSG84 in after the fact to suite the needs of your application.
For more information here is the user guide page for shapefile: - http://docs.codehaus.org/display/GEOTDOC/Shapefile+Plugin The heading is "How to Set the Projection" near the bottom of the page. Jody > Hi, > > I've been able to write some geotools 2.3.2 code to load a shapefile > from a set of files on disk. They load as long as there is an SLD > and PRJ file. I've written more code to load the shapefile with the > SLD in memory but have not been able to figure how to do that without > the projection file? I've tried to use things like forceSchema() and > played with the MapContext but have not had success figuring out what > to do, even with shapefiles on disk without projections (PRJ file). > I've seen posts that mentioned that this works in prior versions of > the api since the projection is forced. As for the data I'm working > with, the projection is standardized within our base as WGS84, but > again several systems within the company do not generate a projection > file (ESRI Arc* products) and there are also thousands of shapefiles > that we own that do not have .prj files. > > Another problem I'm working on is that I'm also going to be receiving > shapefiles from an external system, which will be sending the zipped > shapefile in a byte array in a message over a WAN. The system is out > of our control and doesn't know about PRJ files but has standardized > on WGS84. Since we know what the projection is, we would like to be > able to load this directly into a data store and ultimately into a > map. So my question is what classes or methods could I use, if > possible, to put the shapefile data (the 3 files: .shp, .shx, .dbf) > directly from a byte array into a data store? I suppose I could write > the stream out to disk along with a PRJ file and read it back into > memory, but would like to avoid that since the app will be running via > applet or java web start and may not have permissions to write to disk. > > Anyone out there that could point me in the right direction? > > Thanks much, > sam ramirez > > > > ------------------------------------------------------------------------ > Luggage? GPS? Comic books? > Check out fitting gifts for grads > <http://us.rd.yahoo.com/evt=48249/*http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz> > > at Yahoo! Search. > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > ------------------------------------------------------------------------ > > _______________________________________________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
