Tag Info

Hot answers tagged

4

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 ...


4

I suggest to use an oblique mercator projection as I explained in Using customized Coordinate System for Archaeological site data You have to define the origin in lon and lat WGS84 degrees, and the rotation against true north.


3

In your code, you miss to define a feature type: In GeoTools (and not only), you will first need to define the structure of your data, ie the Feature type (~ schema). For this you have to use SimpleFeatureTypeBuilder that will help to build the feature type, afterwhat you will be able to construct properly the SimpleFeatureBuilder based on the featuretype ...


3

You can use the GeodeticCalculator which should be faster. Something like: package com.envitia.spike; import org.geotools.geometry.DirectPosition2D; import org.geotools.referencing.CRS; import org.geotools.referencing.GeodeticCalculator; import org.opengis.referencing.FactoryException; import org.opengis.referencing.NoSuchAuthorityCodeException; import ...


3

You mention Java in your question title but in your question body and tags it seems that ArcGIS for Desktop is available/preferred. The ArcGIS for Desktop procedure that I would use to do this is to perform the following three steps on one CSV file to make sure the workflow works, and then use Copy As Python Snippet to copy the syntax for the three tools ...


2

This blog post from 2011 explains the change, basically we dropped the 2 from the version numbers to reflect the actual real world process that was occurring. Currently 10.4 is the latest stable release. GeoTools jars are versioned as a group with version numbers are based on 3 digits:: <major>.<minor>.<patch> Major ...


2

GeoTools provides a GeoJSON module which will read in GeoJSON files and convert them to GeoTools Feature Collections - the geometry elements of these collections is stored as a JTS object. So all you need is Geometry geom = (Geometry) feature.getDefaultGeometry();


2

From the WFS 1.1.0 specification which is freely available in the net: Individual exception messages are contained within the element. The mandatory code attribute may be used to associate an exception code with the accompanying message. The optional locator attribute may be used to indicate where an exception was encountered in the request that ...


2

Yes, use ST_GeometryN eg, select st_astext(st_geometryn(st_geomfromtext( 'MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))'),1)); yields LINESTRING(10 10,20 20,10 40). Note, the indexing is based off 1. You could also loop through each one and test for equality, using generate_series to create the indexes, eg, select ...


2

I'm not sure if there is a built in function that does that but you could make your own by testing if a small circle/square around your point intersects a street feature. It is likely that if you even super close to a road, numerical error would creep in and no amount of testing would say a point is EXACTLY ON a segment. (unless it was a vertex point)


1

I guess you added in your classpath gt-epsg-postgres instead of gt-epsg-hsql? Delete gt-epsg-postgresql-11.0.jar from your classpath and add gt-epsg-hsql-11.0.jar into it. EDIT(Inspired by comments): For making the answer more understandable for others: GeoTools was set to store the EPSG projection database into PostgreSQL database. The default is to use a ...


1

SimpleFeatures are used for Vector data, for images you will need a coverage reader. See the image tutorial for a good introduction.


1

If you want to use Java, you have a few libraries available including GeoTools and the Java bindings for GDAL/OGR API. Using these you can code a solution (check out the documentation). However, far simpler would be to install GDAL which comes with pre-compiled utilities and use ogr2ogr. You can wrap that in a batch process as required.


1

Please try to use Maven when using GeoTools - to be honest trying to build any medium sized Java project without is going to be much harder work than you really want. But if you must plead ignorance then at least install it and learn to use mvn dependency:list which for the Shapefile module in GeoTools gives the following dependencies (on trunk so ...


1

You can certainly use GeoTools for this, you will also probably want to look at a relsted project JAITools which does helpful things with rasters. I wrote some code a while back to rasterize circles on to a Grid and output them as GeoTiffs which should point you in the right direction.


1

There are several issues here: OSM uses web mercator (epsg:3857) so that is where your reprojection is going on. Also you need to consider scale - the Natural Earth data is designed to be viewed and used at near to 1:10Million - at that scale your map looks like this and the dot is in the right place. Finally your code can be improved by using a ...


1

I now found the solution. I decided to create a new layer to render the images. The (example) code will be like this: List<SimpleFeature> list = new ArrayList<SimpleFeature>(); SimpleFeature feature = build.buildFeature("fid1", new Object[]{ geom.point(707009.4375,243649.18750000006), "TestImage" } ); list.add( feature ); ...


1

JTS polygons are clockwise (see http://tsusiatsoftware.net/jts/jts-faq/jts-faq.html#B6 for an explanation of why). Why it would give you an invalid geometry is a difficult question to answer with out seeing your input polygons. Most likely causes are self intersection, self touching, invalid geometry in input list.


1

Yes, dealing with distance (or area) in unprojected latitude/longitude coordinates is fraught with peril. The length of a degree of latitude is always the same (60 nautical miles), but the length of a degree of longitude varies with the cosine of the latitude. To do it properly, you want to project your coordinates into some plane coordinate system and do ...


1

If all you want is a picture of the data then you can simply create an image and pass it's graphic object to the renderer in the same way as you would draw to the screen. However if you want a raster representation of the vector map then you should look at the VectorToRaster process.


1

General conceptual answer: One suggestion might be to use a national state projection polygon layer to determine the "only" or a selection of the best local projections. The other option would be UTM zones. But essential run a point in polygon test to return the crs. You don't mention but I am reading into you savvy question that you know you would need to ...


1

In the past I wrote some code to do this that looks like this: public JaiToolsCircle(ReferencedEnvelope env, double cellSize) { this.env = env; this.cellsize = cellSize; System.out.println("cellsize " + cellsize); height = (int) Math.ceil((env.getHeight() / cellsize))+1; width = (int) Math.ceil((env.getWidth() / ...


1

This seems to be a favourite question on Natural Earths forum ;-) A basic introduction is posted here: http://www.naturalearthdata.com/forums/topic/thematic-codes/ http://www.naturalearthdata.com/forums/topic/are-the-attributes-documented/ http://www.naturalearthdata.com/forums/topic/what-does-mapcolor-mean-in-ne_10m_admin_0_countries/ The mapcolor ...


1

I can confirm that the output is wrong. Using QGIS, the reprojected polygon would be: POLYGON ((1008607.2669 934072.252456,1119664.42733 934150.343933,1119791.41667 823552.360893, 1008616.39888 823493.709278, 1008607.2669 934072.252456)) The coordinates have to be positive for the whole of Colombia: But it has nothing to do with the swiss projection ...


1

You could try the Rasterize tool in QGIS (Raster - Conversion)


1

This can be solved by making a negative buffer (0.5m) for each geometry before testing the overlap. E.g. you have this two overlaping polygons, 1m overlap: By making a negative buffer (-0.5m) of the blue polygon you'll get the yellow one: And this are the two buffered polygons: Running the binary predicate test in JTS test builder, you'll get no ...


1

I'm going to go out on a limb and say that you aren't including the False Easting and False Northing in your XY coordinates. EPSG:4456 states the FE and FN values should be 2000000 and 100000 respectively. Being short 2 million feet on the easting value would explain why your point is in Pennsylvania. If you change your point to include these values ...


1

You can create maps using value by alpha using SLD - (the point being that WA has a lower unemployment rate than OR but has more people so it appears more solid). The trick is to use an expression in the fill-opacity element. If you add the SLD file below to a standard GeoServer install you can see the topp:states layer rendered. In GeoTools it is even ...


1

Did you consider using GDAL? Extensive information, Documentation and examples are available on the Geographical Data Abstraction Library. You can get step-by-step help to compile the GDAL.jar library as described here gdal.ReprojectImage(src_ds, dst_ds) from from GDAL Class seems to be what you are looking for though I have never used it yet.


1

Is it accessible, or did it get dropped in parsing? No, it is very much possible to access any node in a KML file provided you don't miss out on the JAXB hierarchy: You may try something like below: final Kml kml = Kml.unmarshal(new File("C:\\"YOUR DIRECTORY"\\Sample_2013_q3.kml")); final Document document = (Document)kml.getFeature(); ...



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