Tag Info

Hot answers tagged

32

Every polygon has, at a minimum, four distinct "centers": The barycenter of its vertices. The barycenter of its edges. Its barycenter as a polygon. A GIS-specific "center" useful for labeling (usually calculated with undocumented proprietary methods). (They may accidentally coincide in special cases, but for "generic" polygons they are distinct points.) ...


29

As scw points out, you want an implementation of α-shapes. Alpha shapes can be considered a generalisation of the convex hull. They were first described in 1981 in: Edelsbrunner, H.; Kirkpatrick, D.; Seidel, R.; , "On the shape of a set of points in the plane," Information Theory, IEEE Transactions on , vol.29, no.4, pp. 551- 559, Jul 1983 ...


20

Here is what you are looking for. You can download and test the program: (in java, under GPL license) The paper presenting the algorithm is there: Duckham, M., Kulik, L., Worboys, M.F., Galton, A. (2008) Efficient generation of simple polygons for characterizing the shape of a set of points in the plane. Pattern Recognition v41, 3224-3236


18

Geography features are always stored in WGS84. Measurements based on geography features will be in meters instead of CRS units and PostGIS will use geodetic calculations instead of planar geometry. There is only a limited list of functions for manipulating/analyzing geography features (but you can cast between geometry and geography). Geography is ...


17

This seems to be a specific application of alpha shapes, which are from my reading a more general form of this problem. R has the alphahull module, which has excellent documentation on computing alpha shapes. Also check this detailed background on alpha shapes. If you only want to compute convex/concave hulls, check out lasboundary, part of lastools, it ...


17

OGC defines standards for geometry types. Among others there is the "Polygon" type and a polygon is a "Surface". OGC defines "area" as the measure of the "surface". OGC: http://www.opengeospatial.org/standards


15

GeoJSON here are the SPECs. Here's an example of a line and a polygon: { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} }, { "type": "Feature", "geometry": { "type": "LineString", "coordinates": [ ...


15

Here's a simple script that uses the OGR python bindings: import ogr,csv,sys shpfile=r'C:\Temp\test.shp' #sys.argv[1] csvfile=r'C:\Temp\test.csv' #sys.argv[2] #Open files csvfile=open(csvfile,'wb') ds=ogr.Open(shpfile) lyr=ds.GetLayer() #Get field names dfn=lyr.GetLayerDefn() nfields=dfn.GetFieldCount() fields=[] for i in range(nfields): ...


15

Yes, there is an analytical solution for this problem. The algorithm you are looking for is known in polygon generalisation as "smallest surrounding rectangle". The algorithm you describe is fine but in order to solve the problems you have listed, you can use the fact that the orientation of the MAR is the same as the one of one of the edges of the point ...


15

To supplement @julien's great solution, here is a working implementation in R, which could serve as pseudocode to guide any GIS-specific implementation (or be applied directly in R, of course). Input is an array of point coordinates. Output (the value of mbr) is an array of the vertices of the minimum bounding rectangle (with the first one repeated to ...


12

There are many algorithms dedicated to building simplification. You may have a look at this website for an overview. See also this question. You could use: Building outline simplification: It consist in recursively deleting too short edges of the outline and lengthening the neighbor edges. Example: Smallest surrounding rectangle algorithm: It consist ...


11

Keeping malformed data is a bad idea, because you can never predict when and where will the failure occur. Moreover, malformed data can cause Heisenbugs, the most vicious and illusive type of bugs. I think that it is a bit pointless to discuss the possible outcome of storing invalid geometries. Having that said, The consequences can include: Wrong results ...


11

If you're looking for a PostGIS function that will tell you a point that's inside your polygon then the ST_PointOnSurface function may give you what you need. SELECT ST_AsText(ST_PointOnSurface('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'::geometry)); st_astext ---------------- POINT(2.5 2.5) (1 row)


10

MapAnalyst - The Map Historian's Tool for the Analysis of Old Maps Calculates Displacement in Historical Maps(displacement vectors,distortion grid,scale isolines,rotation isolines.) "MapAnalyst is a Java application that runs on all major computer platforms. It allows for the efficient identification and management of control points in a historical map and ...


10

In my experience, "polygon" is the word to use for describing the geometry type. (Compare database geometry types for example.) "Area" to me suggests the actual area measure of the polygon feature. "Polygon" is fine for German-speaking audience too. @"Donut Polygon": A Google image search suggests that "donut polygon" is commonly used. "Donut Area" ...


10

The best way is to convert this shape file to file-geodatabase and build the topology in ArcGIS for "Must Not Gaps" and "Must Not Overlap". Important thing in building topology is cluster tolerance. This is tolerance in which topology will remove/fix errors automatically after validating. So you should select this tolerance very carefully as big values can ...


9

I created a highly-efficient tool, called [lasboundary][1,2], that computes a concave hull for LIDAR in LAS/LAZ/SHP/ASCII format and stores the result as a vector boundary polygon in ESRI Shapefile format or a geo-referenced KML file. Here is an example run: C:\lastools\bin>lasboundary -i SerpentMound.las -o SerpentMound_boundary.shp reading 3265110 ...


9

Instead of creating and trying to add a polygon to your array, add your array of points to the array of parts. Change this: polygon = arcpy.Polygon(pntArray) pntArray.removeAll() partArray.add(polygon) To this: partArray.add(pntArray) pntArray.removeAll() Also, there's a problem with your code that tries to insert the row. You need to use your insert ...


9

Shapely is cool and elegant, but why not using still ogr, with its spatial operators (in OGRGeometry class)? sample code: from osgeo import ogr driver = ogr.GetDriverByName('ESRI Shapefile') polyshp = driver.Open('/home/pcorti/data/shapefile/multipoly.shp') polylyr = polyshp.GetLayer(0) pointshp = driver.Open('/home/pcorti/data/shapefile/point.shp') ...


9

One thing to note is that MongoDB's support for spatial datatypes is horrendously bad for any serious spatial lookup, and this applies across the board with NoSQL last time I checked. I dislike GeoCouch quite a bit less, but it also still has a way to go. GeoJSON is a fantastic format but to take advantage of the limited (POINT-ONLY) spatial indexes in ...


9

The answer depends on context: if you will be investigating only a small (bounded) number of segments, you might be able to afford a computationally expensive solution. However, it seems likely that you will want to incorporate this calculation within some kind of search for good label points. If so, it is of great advantage to have a solution that either ...


8

Routine uses of 2D and 3D affine transformations in GIS include Map-to-display transformations Registering images and rasters Changing 3D viewpoints Modifying features by rescaling, shifting, and rotation Datum changes (3-point and 7-point formulas). These are described in more detail and illustrated for the 2D case on this Web page, which is found when ...


8

I'm not familiar with networkx but if I understood correctly your question, you could use shapely and OGR lib for finding point in polygon from shapefile. Here is one example how it works for finding if one point (2000,1200) fails withing any polygon from one shapefile. For the result, it prints coordinates of that polygon. from shapely.geometry import ...


8

With ogr2ogr, you can specify a bounding box that you'd like to clip by with -clipsrc x_min y_min x_max y_max, so for example, to only get the northern hemisphere of a global dataset you could do: ogr2ogr -f "ESRI Shapefile" borders_north.shp borders.shp -clipsrc -180 0 180 90 See the ogr2ogr documentation for further options, including clipping to ...


8

Indeed there is! Look here for how to achieve it with the Add Delimited Text Layer plugin. Essentially you create a CSV file (although you should use a delimiter other than comma), where one column is the WKT representation of your geometry. Then when you select that file in the plugin, it picks up that there is a WKT column, and does the right thing. I ...


8

An algorithm for your problem is described here. You may be interested by its implementation in CGAL.


8

The coordinate precision is going to be an important consideration here. Floating point numbers cannot be stored exactly. If you use the Feature Compare tool, does it come up with the expected result using the default XY tolerance?


7

Building on whuber's answer, if you wanted to implement this in Python, you'd calculate the displacement as stated, then create an output as a collection of points like so: import arcpy from math import radians, sin, cos origin_x, origin_y = (400460.99, 135836.7) distance = 800 angle = 15 # in degrees # calculate offsets with light trig (disp_x, disp_y) = ...


7

This is simply not true, "to take advantage of spatial indexes in Mongo, you'd need a spatially indexed collection holding nothing but a record for each of the polygon's points, with an additional value for the record ID of your spatial record living in another collection, then use a bounding box query to get record IDs from one [collection] and select ...


7

Area is a Measurement - Like Length, Perimeter etc Polygon is a shape (geometry) - Like hexagon - but has area and length. Translation: German Vieleck - Polygon Die Umgebung - The environment (reverse translate) - Area French: Espace - Space - Area Polygone - Polygon So Polygon is a better word for Translation to German and French



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