Forgive my personal density. I’m a casual user of geotools at best.
We are not using MapServer or anything of the sort. We are developing a website
that allows users to upload KML and other geographic data, parse and enhance
the contents, and store it in PostGIS. We want to use geotools because the KML
parser allows us to easily consume the input and convert it to a jts Geometry
object, which can be directly deposited into the database. We just use geotools
as an add-in to parse the KML. The example code came directly from the geotools
documentation, and that’s really all the code I have. I just can’t find a way
to tell it to use lon/lat instead of lat/lon.
InputStream inputStream = new
FileInputStream(file);
Parser parser = new Parser(new
KMLConfiguration());
SimpleFeature f = (SimpleFeature) parser.parse(
inputStream );
Collection<SimpleFeature> features =
(Collection<SimpleFeature>) f.getAttribute("Feature");
______________________________________
Randall S. (Randy) Avis
Senior Software Engineer
KEYW Corporation
571-421-8566 (office)
703-609-7837 (cell)
ra...@keywcorp.com<mailto:ra...@keywcorp.com>
From: Jody Garnett [mailto:jody.garn...@gmail.com]
Sent: Tuesday, March 17, 2015 4:30 PM
To: Randall S. Avis
Cc: geotools-gt2-users@lists.sourceforge.net
Subject: Re: [Geotools-gt2-users] KML consumption Lat/Lon issue
It may depend a bit on the srs name, if you are using the full "URI" form then
the values will be as provided in the EPSG database.
You may wish to use the WMS srs name "CRS:84" which is always in the correct
order (since it is formally defined that way). See
http://gis.stackexchange.com/questions/54073/what-is-crs84-projection for
details.
--
Jody
--
Jody
--
Jody Garnett
On 17 March 2015 at 05:12, Randall S. Avis
<ra...@keywcorp.com<mailto:ra...@keywcorp.com>> wrote:
All;
I’ve been working with the parser to open and read KML files, and produce jts
Geometries. The examples I found on the geotools site and elsewhere make it
relatively simple except that the latitude and longitude are reversed from the
values in the KML.
I found the documentation entry
(http://docs.geotools.org/latest/userguide/library/referencing/order.html) that
says to set the forceXY property to true, but that does not seem to work. I’m
running a web application using Spring 4 and have tried inserting the
System.setProperty call in the constructor method for my geotools service, and
I found a sample to put in my application.xml file, but neither force the
lon/lat format on the output. Here’s the setup code:
InputStream inputStream = new
FileInputStream(file);
Parser parser = new Parser(new
KMLConfiguration());
SimpleFeature f = (SimpleFeature) parser.parse(
inputStream );
Collection<SimpleFeature> features =
(Collection<SimpleFeature>) f.getAttribute("Feature");
By the time I get to the third step, everything has been parsed as lat/lon. I
don’t see any arguments for the KMLConfiguration() that would allow me to
specify the forceXY or anything else.
I’m using geotools 12.2. Does anyone have any suggestions?
______________________________________
Randall S. (Randy) Avis
Senior Software Engineer
KEYW Corporation
571-421-8566<tel:571-421-8566> (office)
703-609-7837<tel:703-609-7837> (cell)
ra...@keywcorp.com<mailto:ra...@keywcorp.com>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net<mailto:GeoTools-GT2-Users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users