New answers tagged

1

Just use the maxPoints parameter: map.addInteraction(new ol.interaction.Draw({ source: source, type: 'LineString', maxPoints: 2 })); Here a JSFiddle


4

You want to use ST_DWithin() which takes advantage of indexing SELECT * FROM adresse WHERE ST_DWithin(latlong::geography, ST_SetSRID(ST_Point(16.520, 47.846), 4326)::geography, 200) ORDER BY ST_Distance(latlong::geography, ST_SetSRID(ST_Point(16.520, 47.846), 4326)::geography); See also http://postgis.net/2013/08/26/tip_ST_DWithin/


3

I would intersect the boundaries layer with the tree layer (Vector -> Geoprocessing Tools -> Intersect, input:boundaries, interesct: trees) in order to get a "tree layer" which is split across boundaries and has the boundary ids. After that, you can calculate statistics per administrative boundary.


0

If I understand your question correctly, you could try Vector > Research Tools > Select by Location and choose the features in the Tree cover layer which intersect with your Provinces layer. Then save the selected polygons to a new shapefile and work on that.


2

GDAL has no problem with GeoJSON http://geojson.org/geojson-spec.html. The following GeoJSON encodes one multilinestring: { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type":"MultiLineString","coordinates":[[[11.20558631,46.48251782],[11.2058444,46.48280049]],[[11.20578705,46.48252192],[11.20596731,46.48275133]]],"crs":{"...


0

I think your for loop is incorrect. Since texasPipeline.graphics is an array, you would use forEach instead of for ... in. You can get even fancier by using array.map to turn them into an array of graphics in one line. Here's a JSFiddle illustrating that. Hope this helps! https://jsfiddle.net/gavinr/rbcagx93/


3

Pyshp does not have a WKT method but it does support the geo_interface protocol at the shape level. That protocol returns each shape as geojson. You can then use the lightweight, pure-python pygeoif module to convert to WKT. The pygeoif module is available on the Python Package Index and Github: https://pypi.python.org/pypi/pygeoif/ https://github.com/...


1

I am not sure if this is a more efficient way but you could also compare the area of the input polygon to the area of the convex hull of the same polygon. Idea: The area of the convex hull of a concave polygon is always bigger then the area of the concave polygon itself. Simple method: public static boolean isConvexPolygon(Polygon p){ // calculate ...


0

Modify your function: //function to select the park function getParkFeature(in_park_name) { var sfs = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASHDOT, new Color([255,0,0]), 2),new Color([255,255,0,0.25]) ); var query = new Query(); query.where = "NAME='" + in_park_name + "'"; ...


1

You need to iterate through the segments of the line to find the one that touches/intersect the polygons (as in Get the vertices on a LineString either side of a Point) I show here the results with one line and one polygon as example # transform the line to a list of points linegeom = liengeom.asPolyline() # extract the segments seg_start, seg_end of ...


2

Try out with 'intersects' and 'intersection' methods. Next code produces only two points. mapcanvas = iface.mapCanvas() layers = mapcanvas.layers() feats_line = [ feat for feat in layers[0].getFeatures() ] feats_poly = [ feat for feat in layers[1].getFeatures() ] for feat_l in feats_line: for feat_p in feats_poly: if feat_p.geometry()....


0

The ST_PointOnSurface documentation doesn't specifically mention POLYGON Z, so assume it doesn't work for now. The ST_Centroid documentation doesn't mention Z at all. However, you can incorporate ST_3DClosestPoint into your statement to get the closest 3D point between the cell and its center (or point on surface). SELECT ST_AsText( ST_3DClosestPoint(cell,...


0

Just select the CRS in the layer definition : QgsVectorLayer('Polygon?crs=epsg:2154', 'poly' , "memory") for instance (here EPSG 2154 is for Lambert 93 projection, standard in Metropolitan France, but you can put whatever you want)


3

So are you wanting to add to the existing features? If so, have a look at the Append tool. It will keep the original features and continue to add to them. Note that the features should have the same schema.


0

Now I have some trouble, I try to fill my geometry column with the following code : for i in range(0,len(list)): cur.execute("INSERT INTO %s (geometry) VALUES ('Polygon Z ((%s %s %s, %s %s %s, %s %s %s, %s %s %s))')" %(table_facette, Xp1[i], Yp1[i], Zp1[i], Xp2[i], Yp2[i], Zp2[i], Xp3[i], Yp3[i], Zp3[i], Xp1[i], Yp1[i], Zp1[i])) conn.commit() I got ...


0

I believe the number that you'd want to use at this point would be srid 4619 or srid 4977 is SQL server. These are both equivalent to EPSG 3011.


2

I am not sure I really understand what you are doing. How can a point cluster be a collection of linestrings? , but .. Remember you are using a spatial database, why not use the functionality in PostGIS? from a bunch of points you can collect them and use ST_Centroid on the collection. Or if it really is a collection of linestrings that you want to get ...


2

The Example from the spatialite cookbook https://www.gaia-gis.it/gaia-sins/spatialite-cookbook/html/new-geom.html denotes: SELECT AddGeometryColumn('test_geom', 'the_geom', 4326, 'POINT', 'XY'); Strings are quoted here, so try to modify your comand to cur.execute("SELECT AddGeometryColumn('%s', '%s', %s, '%s', '%s')" %(table_name, geometry_column_name, ...



Top 50 recent answers are included