Tag Info

New answers tagged

1

My methodology to accomplish this task has always been using ArcGIS's selection tools on feature layers. Something like this: arcpy.MakeFeatureLayer_management (polygon, "lyr") #The check for item in features: arcpy.SelectLayerByLocation_management ("lyr", "CONTAINS", item) #Check for selection, i.e. item is contained within polygon if ...


1

The only success I have had after using UnionAggregate to use QGIS to move the feature from SQL Server to a shapefile and then ArcGIS can read it.


1

Given Paul Ramsey's excellent explanation of why the next question is what can be done about it. How do you SELECT DISTINCT on geometry fields and have it perform as expected? In Paul's answer, I proposed using SELECT MAX(geom) FROM the_table GROUP BY ST_AsBinary(geom); but MAX() is slow, apparently requiring a table scan. Instead, I found this to be ...


0

edit: i did a bit of fiddling and realized that my original answer is incorrect. you need to loop through individual graphics and add() them one at a time because the graphics property of GraphicsLayer is not 'settable'. that being said, its important to note that there would be no performance benefit of the API exposing a technique to loading graphics in ...


2

I disagree that QGIS always uses multipoint. If you use the Extract Nodes tool, you get a single point layer, and converting Multipart to singlepart and back changes the geometry type as expected. You can run ogrinfo on the shapefiles to check the geometry type. Unfortunately, QGIS reports the layers metadata always as Point.


1

Here are your starting shapes: At one billionth (10^9) of a degree precision (the same scale as your coordinates in the WKT), I receive a self-intersection error from the Esri geometry library. The geometry really is invalid as presented. If I increase the precision to 10 billionths (10^10), I get long slivers in the middle of the shape: If I back the ...


4

You don't need constraints for PostGIS 2.x, just us typmods. For 2D geometries with SRID=4326, the typmod is geometry(Geometry,4326). Or for M-dimension geometries, it would be geometry(GeometryM,4326) (you get the idea). Example: create temp table sometable(wkt geometry(Geometry,4326)); -- works insert into sometable(wkt) values('SRID=4326;POINT(1 2)') ...


3

@BradHards is right. Having mixed types is probably going to cause problems down the road. If you're sure your tools can handle mixed types, or you're going to be retrieving them some other way (through DB views, or programatically) you can split the constraints into two parts, either of which is optional: To modify your existing table -- Only check the ...


1

When I have a layer with errors , I normally run it through the GRASS function v.clean in the Processing Toolbox. Though I never really figured out which tool is best in which case, I normally choose the bpol function there. Maybe even more important it is to set the advanced parameters for snap tolerance and min area. Depending on the layer, I usually ...


1

(Credit to @Russell at ISC for the use of the modulo operator.) We have a table in SQL Server with a column of geography data type, called [GeoCoor]. This is how we convert to degrees, minutes, and seconds: SELECT [GeoCoor].[Lat] as [DecimalLatitude], floor(ABS([GeoCoor].[Lat]))*(CASE WHEN [GeoCoor].[Lat] < 0 then -1 ELSE 1 END) as [LatDegrees], ...


3

Example for point layer def FindLabel ( [FID] ): mxd = arcpy.mapping.MapDocument("CURRENT") layers=arcpy.mapping.ListLayers(mxd, "ac_pipes_aspoints") lr=layers[0] with arcpy.da.SearchCursor(lr, 'Shape@XY',r'"FID"='+str( [FID] )) as cursor: for row in cursor: a=row[0] return a[0]


4

This is a GDAL/OGR Python gotcha. So when you use print inputlyr[0].GetGeometryRef(), the reference to the indexed feature has been cleaned up before geometry functions can be used. This is expected behaviour, and there is no roadmap to change it. The issue is that the GDAL/OGR Python bindings are over a decade old, and are tightly coupled with the ...



Top 50 recent answers are included