Tag Info

Hot answers tagged

22

Sorry, the answer is no. You have to roll out your own field mapper and only software that uses your mapper will understand it. You could use other formats that do not have this limitation though (e.g. filegdb, spatialite, etc). UPDATE: Some word of advice about the workarounds from personal experience. When people choose shapefiles (and insist on them) ...


12

A few ideas come to mind for building your geospatial programming credentials: Create a legacy of solutions and answers on GISse and Stack Overflow. You will notice that many people on GISse creatively and wisely use this forum to further their freelance work. Create a web page or blog to show potential employers what you know. Some of my favorites, and ...


8

It looks like there was a fork that was intended to be reintegrated, but this never happened. In response to the deteriorating quality of some GeoTools code base, Martin Desruisseaux embarked on a major cleanup effort. In July 2008, Martin created a new, initially empty, source code repository and proceeded to copy the GeoTools classes to ...


8

There is a standard way to deal with this, although your clients might not be completely happy with it: you export two files, a shapefile and a data file in a format their software can read. The shapefile has only a unique identifier, [Id], for attributes. The data file has several attributes: [Id] to match the shape, [Field] to provide the field name, ...


7

You could use the "proper" ellipsoidal Mercator (EPSG:3395). That projection is truly conformal, as opposed to the "Web Mercator" (EPSG:3857), which uses a spherical approximation. This comes at a computational cost, however (about a factor of 5 for the forward and reverse projection, according to the table on slide 10 of Noel Zinn's presentation). Also, ...


6

I think the way that we create mapping applications is changing fast and the key to success in this industry is being ahead of that curve. For example 10+ years ago when we wanted a blog we get a shared hosting solution, download a blogging platform like Wordpress or Movable Type install it on the server, buy a domain name, install a theme, bang our head ...


5

For Java, I'd recommend JTS Topology Suite. There is both a "Nearest Point" and "Closest Point" routine (I'm not sure if it is the same, or was renamed between versions) that does what you want. The result from the above is LINESTRING (205 305, 250 300), so the first point of the result is your closest point coordinates, and the length property of the ...


5

hallo first, in the post in stackoverflow the discussion is about getting a GPS point and say if it is a building or a road. AFAIK, GPS does not have that precision. I never expect a GPS point to be more precise than 10 meters. of course it often is a little better than that but it can also be much more wrong. In Routing GPS units the software often snap ...


5

The units of measurement is based on the underlying spatial reference. So, for example, if it is EPSG:4326 it is decimal degrees or if it EPSG:2037 it is meters.


4

You can also look at http://svn.osgeo.org/geotools/trunk/modules/library/xml/src/test/java/org/geotools/GMLTest.java to see how the tests do it. The key section seems to be: GML encode2 = new GML(Version.GML2); encode2.setBaseURL(baseURL); encode2.setNamespace("location", "location.xsd"); encode2.encode(out2, collection); out.close(); ...


4

Maven can only handle libraries that are deployed on a maven repository, and Opencarto is not deployed anywhere, so you cannot get it with maven. To use it, you may use one of these methods: you download an opencarto jar from there and include it in your eclipse project (you also need jts, xstream and xpp3_min) you checkout the snapshot version of ...


4

The answer depends on how the question is interpreted. One interpretation is, "Given that a GPS point is known (or assumed) to lie either on a building or on a road, what are the odds that it lies on the road?" To find this, compute a grid representing a 2D Gaussian function whose standard deviation equals the expected error in the GPS position. Use a ...


4

Is this what you're after? http://weblogs.java.net/blog/cajo/archive/2010/10/16/adding-google-maps-your-java-application You can also use Bing maps with Java, also worth looking at GeoTools NASA Worldwind OpenMap There's also a useful list of OpenSource Java GIS software here: http://java-source.net/open-source/geospatial


4

I've created a while ago a method to draw points on a layer from geotagged flickr pictures. It shows basically how to create a FeatureLayer with custom points public Layer getFlickrLayer(){ SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName( "pictures" ); b.setCRS( DefaultGeographicCRS.WGS84 ); //picture location ...


3

You'll need to add a WMS layer for your background map. The GeoTools tutorial has sections on adding WMS layers and querying databases (Example uses a PostGIS database). You might want to check them out.


3

You could use the JTS WKTWriter to convert geometries read in from the Shapefile to WKT and then save the strings to a file the user chose. Reading in a Shapefile and accessing the geometries are covered in the CRS tutorial.


3

The KML support is tied into the XML facilities for encoding and parsing geometry. The GeoTools user guide has replaced the wiki links provided by Ian above - with a nice clear page devoted to wrangling geometry and XML: http://docs.geotools.org/latest/userguide/library/xml/geometry.html One of the headings on that page is devoted to KML ...


3

There is a KMLExample at http://svn.osgeo.org/geotools/trunk/demo/example/src/main/java/org/geotools/demo/xml/KMLExample.java which shows the KML bindings in use for writing. From other discussions on the user list it seems that the KML bindings work in a similar way to the GML bindings so look at http://docs.codehaus.org/display/GEOTDOC/GML+XML+Support for ...


3

I haven't got a full answer but an important point is the context of the building and the road. GPS accuracy falls dramatically in a very built up area because the radio signals are obscured by and bounce off buildings. So GPS readings in the country by a low building will be far more accurate than in a skyscaper 'canyon' as you get in major cities.


3

Try: //create the encoder with the gml 2.0 configuration org.geotools.xml.Configuration configuration = new org.geotools.gml2.GMLConfiguration(); org.geotools.xml.Encoder encoder = new org.geotools.xml.Encoder( configuration ); //output stream to serialize to OutputStream xml = ... //encode encoder.encode( featureCollection, new QName( ...


3

An Oblique Mercator will have near-zero distortion along a great circle of contact; that excludes all circles of latitude (except the Equator). Projections that minimize distortion along circles of latitude tend to be derived from conic projections and their limiting forms, cylindrical projections. The conic projections are usually good only for ...


3

I have followed the resource pointed out by @iant and.. Here's the solution: public static void toShp(File geojson) throws IOException { File shpFile = new File("test.shp"); ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory(); Map<String, Serializable> params = new HashMap<String, Serializable>(); ...


3

A couple of options: Convert the PostGIS layer to a shapefile in QGIS (save-as), then use the Vector|Conversion|Rasterize tool; Use the gdal_rasterize command directly. For the second option: gdal_rasterize -a VAL -ts [x] [y] PG:'host=localhost dbname=DB user=USER' -sql "SELECT the_geom, VAL FROM table" out.tif Where: VAL = the value to assign ...


2

There is example code on using the GeoTools CRS module at http://docs.geotools.org/stable/userguide/examples/crslab.html which shows how to make the transformation if you know the EPSG codes of the two projections you want to use. If you don't know the EPSG codes then you can look them up at http://spatialreference.org, if however the code you want doesn't ...


2

This actually makes the geotools faq page for gt-swing. The real answer is to use JMapPane as an example (because that is what it is) and build your own widget using a number of layers for a fast response. You may also find the spatial indexed back feature collections useful in providing a fast experience if you don't mind holding your data in memory. ...


2

http://docs.codehaus.org/display/GEOTDOC/Closest+Point+on+a+Line seems to discuss the solution to your problem. --- update by author of that page -- This page has been ported to sphinx based documentation: http://docs.geotools.org/latest/userguide/library/jts/snap.html That page just goes through how the JTS classes for snapping to a line can be used.


2

I encountered a similar problem to what you describe, and found the source of the problem after some code inspection. The main problem is that during the addFeatures call, a CopyOnWriteArrayList is used at some point to store all features that are to be written. (This is regardless if you add your features one at a time, or in batches.) This list ...


2

If your question is "how do I put OSM data into PostGIS so that GeoTools can read it?" then I wrote up some notes on this last year at http://ian01.geog.psu.edu/geoserver_docs/data/openstreetmap/index.html. Once the data is in PostGIS then R.K's links should help you access it using GeoTools.



Only top voted, non community-wiki answers of a minimum length are eligible