Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 2581

(1) abstract geometry; (2) storing geographic data in projected coordinates; (3) a generic ESRI term for vector features; a class for "geometry" objects.

7 votes
Accepted

How to convert a geometry into LineString whose start and end point is equal?

A LineString with the same start and end point is not a Polygon but a LinearRing. You need to understand the difference. If you want a Polygon from the LinearRing # test if your output is a LinearRi …
gene's user avatar
  • 55.4k
5 votes
Accepted

How to save changes in Feature-Geometry with GDAL/OGR and Python? (Segmentation fault)

=0: buff = geom1.Buffer(0.0001) linkline = geom2.Intersection(buff) linkpoint = linkline.GetPoint(0) # create a new ogr geometry with wkt here …
gene's user avatar
  • 55.4k
2 votes
Accepted

Python library for geometrical calculations using with GRASS GIS?

Sympy is inappropriate here (or very difficult to use). For geometrical calculations in 2D, the best solution is Shapely. But don't forget that GRASS GIS 6.4.x has the module grass.script (look at …
gene's user avatar
  • 55.4k
1 vote

How to get Lat/Lng from a Geometric property?

It is a part of a GeoJSON formated geometry and the ordering of x and y are important. …
gene's user avatar
  • 55.4k
34 votes
Accepted

How to draw polygons from the python console?

it is not realy complicated, look at Memory provider in vector: : a point is created with QgsPoint(x,y) and QgsGeometry.fromPoint(QgsPoint(x,y)) a line is created with two points: QgsGeometry.fromPo …
gene's user avatar
  • 55.4k
10 votes

Get the vertices on a LineString either side of a Point

I don't understand your question: line = LineString([(0, 0), (2, 2)]) # create a point which lies along the line point = line.interpolate(1) line.contains(point) True You want the two lines which li …
gene's user avatar
  • 55.4k
5 votes

Converting GeoJSON to Python objects?

There are many geospatial Python modules that can convert GeoJSON to shapefiles (and the reverse): Fiona PySAL Pyshp 1.7 and up GDAL/OGR PyQGIS with the new API python-geojson see Python Geo_inte …
gene's user avatar
  • 55.4k
4 votes

How do I convert WKT geometry from 3D to 2D

WKT is only a text markup language for representing vector geometry, therefore you cannot convert 3D WKT to 2D (= text to text), you need to change the geometry The problem with ogr is that it seems that … False point.GetGeometryType()==ogr.wkbPoint25D True 2) But, with the creation of a 2D point with Shapely from shapely.geometry import Point pt = Point(1198054.34, 648493.09) # conversion to an ogr geometry
gene's user avatar
  • 55.4k
2 votes
Accepted

Finding intersection length between two polygons using PyQGIS?

intersects gives the boolean value True, False, intersection gives the geometry If you use the dir function of Python dir(intersection) ['Error', '__class__', '__delattr__', '__dict__', '__doc__', ' …
gene's user avatar
  • 55.4k
7 votes
Accepted

How to join geodataframe itself

nearest_geom = nearest_points(point, multipoint) d = queried_geom.distance(nearest_geom) df.loc[index, "nearest_geom"] = str(nearest_geom) df.loc[index, "dist"] = d print(df) id geometry … 2, algorithm='ball_tree').fit(coords) distances, indices = nbrs.kneighbors(coords) And after: df['ind1']= indices[:,0] df['ind2']= indices[:,1] df['dist']= distances[:,1] print(df) id geometry
gene's user avatar
  • 55.4k
0 votes

Python library or algorithm to generate arc geometry from three coordinate pairs?

Shapely PyQGIS, and GeoDjango use the same API based on the GEOS library: With Shapely: with a list of points: from shapely.geometry import Point, LineString, mapping pt1 = Point(0,0) pt2 = Point …
gene's user avatar
  • 55.4k
3 votes

Drawing some points in QGIS 2.4 using Python

QgsField("latStart", QVariant.String), QgsField("lonStart", QVariant.String), QgsField("latEnd", QVariant.String), QgsField("lonEnd", QVariant.String) ]) # create a feature feat = QgsFeature() # add the geometry
gene's user avatar
  • 55.4k
6 votes

Can QGIS import Multipatch geometry type?

In QGIS try using GDAL/OGR to read shapefiles and in GDAL: ESRI Shapefile MultiPatch files are read and each patch geometry is turned into a multi-polygon representation with one polygon per triangle … Control in Python with Fiona import fiona c = fiona.open(fiona.open("4_134.shp")) print len(c) #number of features 1 first = c.next() print first['geometry'] {'type': 'MultiPolygon', 'coordinates': [ …
gene's user avatar
  • 55.4k
2 votes
Accepted

fiona writing geometry into shapefile problem

Writing the shapefile import fiona from fiona.crs import from_epsg my_schema={'geometry': 'Point', 'properties': {'intLanes': 'str', 'y': 'str', 'incLanes': 'str', 'junction_shape': 'str', 'x': 'str', … 'type': 'str', 'id': 'str'}} wr_dict = {'geometry': {'type': 'Point', 'coordinates': (488901.97760411515, 5078198.250875515)}, 'properties': {'intLanes': ':A_0_0 :A_1_0', 'junction_shape': '30.62,42.35 …
gene's user avatar
  • 55.4k
2 votes

Remove the intersecting parts in a set of polygons

( W.component_labels) [0 0 1 2 3 4 3] There are 2 groups with polygon intersections, 0,1 and 4,6 gdf['inter']= W.component_labels #labels of connected components: print(gdf) id geometry … "] = g.geometry[g.index[0]]- g.geometry[g.index[1]] gdf.loc[g.index[1],"geometry"]= g.geometry[g.index[1]]- g.geometry[g.index[0]] for name, group in groups: if len(group) > 1: # intersection …
gene's user avatar
  • 55.4k

15 30 50 per page