New answers tagged

0

You need to close the polygon by adding the start point to the end of the list of points that you build the WKT with. So change it to: for (var z = 0; z < arreglo.length; z++) { arreglo2.push(arreglo[z][0]+" "+arreglo[z][1]); } arreglo2.push(arreglo[0][0]+" "+arreglo[0][1]); But I'm pretty sure you can use the OpenLayers WKT ...


0

That note is over 7 years old so things have moved on a little since then :-) For current best practice you should look at the org.geotools.swing.tool package in the unsupported swing module. As far as I can see the idiom is to work directly on the MapPane passed in at construction.


0

Your error has nothing to do with JSON, there is a problem with the PostGIS datastore jar on your path. The most likely cause of this issue is that you have combined jars from different GeoTools releases. Check your pom.xml file - the usual practice is to use a property geotools.version set to the version you plan to use: <properties> ...


0

As you noticed in the previous discussion GeoTools used to have a complex event system to handle updates but it fell into disuse and no one has felt the need to fix it. The majority of GeoTools users manage the GUI (if they have one at all) themselves and "know" when to do a redraw based on the internal logic of the program. You can directly call redraw on ...


1

I can recreate this response from a local GeoServer but only when I send a connection request to a GeoServer that doesn't have a user of the name requested. When I have set up a user then it works exactly as I expect. With regards to @Dani's comment I don't get a FeatureStore which is expected as the WFSStore doesn't support writes when you use version ...


0

The most likely answer is axis order - if you check the DirectPosition2D API docs you will see the following warning: This class inherits x and y fields. But despite their names, they don't need to be oriented toward East and North. The (x,y) axis can have any orientation and should be understood as "ordinate 0" and "ordinate 1" values instead. ...


0

To read various file formats for rendering GeoTools uses a DataStoreFinder mechanism that allows you to call it with a Map of keys & parameters and then it searches all the available DataStoreFactories to see which one can process those parameters. For your file based stores all you need to do is: HashMap<String, Object> params = ...


2

The geometry column of a ShapeFile must be called "the_geom", your's is called "location" so the ShapefileWriter ignores it. change SimpleFeatureType featureType = DataUtilities.createType( tipoShape, "location:" + tipoShape + ":srid=4326," + "number:Integer"); to SimpleFeatureType featureType = DataUtilities.createType( tipoShape, "the_geom:" + ...


0

Your described approach will not work as the styling engine (renderer) only has information about the current feature when it comes to draw it. The easiest solution is to import your shapefile into your database and then create a view that joins the roads with the table holding your traffic details and use that to draw the map. It will be faster and more ...


0

If I understand what you want then it should be a simple filter like: Rule rule = sb.createRule(textSymbolizer); rule.setFilter(sb.getFilterFactory().greater( sb.getFilterFactory().property("traffic"), sb.getFilterFactory().property("current_trafic"))); FeatureTypeStyle fts = sb.createFeatureTypeStyle("Feature",rule);


0

Following the discussion, it looks like the newest release of the plugin is supposed to be compatible with Elasticsearch v2.2.0. However, meanwhile Elasticsearch v2.3.1 has been released and v5.0.0 is already available as an alpha release, so it would be interesting to know if the plugin is compatible at least with the former (the latter will probably ...


0

Your problem seems to be this line: TextSymbolizer text = sb.createTextSymbolizer(null, fonts, sb.createHalo(), sb.attributeExpression("Location"), pointPlacement, "Location"); Where you use Location for the text but I suspect it is your geometry. I use code like this as I have a label attribute with the text I require, see this blog post for a longer ...


0

Simply create an SLD style with a MaxScaleDenominator set to the value that you want the labels to be added and a TextSymbolizer with a reference to the traffic volume attribute. You will probably want to set some of the options listed at the bottom of the TextSymbolizer section of the documentation.


0

I read about connection pooling and found that I only need to close the "parent" connection. finally { if (itr != null) itr.close(); if (con != null && !con.isClosed()) con.close(); }


0

You shouldn't be opening your own connections, let GeoTools manage that for you. I have used the following code (with a PostGIS connection as I don't have Oracle installed) and it is fine. The main trick is to make sure you close your featurereaders/featurecollections/iterators, otherwise they will hang on to a connection until they are garbage collected. ...


0

To the best of my knowledge there is no code to do this on GeoTools as GeoTools confines itself to reading and writing data formats and handles styling as a separate matter. You could look at (and probably use) the code in GeoServer that handles writing out KML with a style.


0

I've found a sample answer. Just find the available layers in the map and apply a filter for each layer separately. Following is the code I used. MapContent con = mapPane.getMapContent(); con.layers(); for (Layer l: con.layers()) { FeatureType schema = l.getFeatureSource().getSchema(); String geometryPropertyName = ...


2

The KML Encoder (like most of GeoTools) works with features not geometries so you need to wrap your polygon in a feature, this gives you the opportunity to add some attributes to make your KML more useful too. public static void main(String[] args) throws IOException { File t = new File("test1.kml"); SimpleFeatureTypeBuilder builder = new ...


1

I've followed selection lab of geotools. Source here. It would be an answer for this question.


0

You would use a JMapPane - for the most part I would look at the code for JMapFrame and cherry pick the parts I needed in my application.


0

GeoTools uses the OGC standard EPSG database to determine the contents of the .prj file. The WKT format standard doesn't mandate any standard names for object in the CRS. So provided the actual parameters match, as they do in this case, the CRS are identical. The ESRI formatter is primarily designed to put the entire WKT onto one line rather than rewrite ...



Top 50 recent answers are included