[gdal-dev] polygon union

2021-10-14 Thread ni hao
Hi list, I know how to union two polygons using Python's ogr. feat = ogr.Feature(lyr.GetLayerDefn()) feat.SetGeometry(collection1.Union(collection2)) But I need to do this in Java or use a command line exe, and I am not familiar with Java. What is the Java function or a command line exe ? T

Re: [gdal-dev] Polygon operations

2021-06-20 Thread Met Bas
Even Rouault-2 wrote > The polygon of a cutline is reprojected into the coordinate system of > the source image, so densification of its contour might have an effect > indeed. > > Le 19/06/2021 à 22:27, Metabase Account a écrit : >> I might be thinking of this incorrectly, but if they're done in

Re: [gdal-dev] Polygon operations

2021-06-20 Thread Andreas Oxenstierna
Correct, you must always densify a line to mimic the behaviour of great-circle, loxodrome etc. in all spatial operations - depending on the definition of the data CRS. This is a necessity in all ”long navigation” use cases like aero and nautical. Hälsningar Andreas Oxenstierna T-Kartor Geospat

Re: [gdal-dev] Polygon operations

2021-06-19 Thread David Strip
On 6/19/2021 2:52 PM, Andrew Bell wrote: The X and Y dimensions are assumed to lie on a plane. All intersection points are also assumed to lie on the same plane as the polygon. Z values are assigned after the fact. On Sat, Jun 19, 2

Re: [gdal-dev] Polygon operations

2021-06-19 Thread Even Rouault
The polygon of a cutline is reprojected into the coordinate system of the source image, so densification of its contour might have an effect indeed. Le 19/06/2021 à 22:27, Metabase Account a écrit : I might be thinking of this incorrectly, but if they're done in 2D without any spatial consider

Re: [gdal-dev] Polygon operations

2021-06-19 Thread Metabase Account
I might be thinking of this incorrectly, but if they're done in 2D without any spatial consideration, inserting additional vertices in between shouldn't have an effect on behavior right? However it does seem to have an effect when using operations such as warp with the polygon as the cutline. On S

Re: [gdal-dev] Polygon operations

2021-06-19 Thread Andrew Bell
These are done in 2D, without regard to the spatial reference. On Sat, Jun 19, 2021, 11:31 AM Met Bas wrote: > From my understanding, a square polygon feature would only consists of the > 5 > vertices of the corners (with the last vertex being the same as the first > to > "close" the polygon). >

[gdal-dev] Polygon operations

2021-06-19 Thread Met Bas
>From my understanding, a square polygon feature would only consists of the 5 vertices of the corners (with the last vertex being the same as the first to "close" the polygon). If I do an operation depending on a polygon, for example intersections or clipping a raster, how is the path between the

Re: [gdal-dev] Polygon intersection failure

2018-07-17 Thread Even Rouault
On mardi 17 juillet 2018 14:33:42 CEST Jon Morris wrote: > Hello all, > > I'm having a problem with layer intersection and am not sure if I'm using > the options correctly or if there is some functionality missing. I'm using > GDAL 2.2.0 with Python 2.7. > > I've got a layer of UK postcodes and a

[gdal-dev] Polygon intersection failure

2018-07-17 Thread Jon Morris
Hello all, I'm having a problem with layer intersection and am not sure if I'm using the options correctly or if there is some functionality missing. I'm using GDAL 2.2.0 with Python 2.7. I've got a layer of UK postcodes and a layer of UK buildings; when I run postcode_lyr.Intersection(buildin

[gdal-dev] Polygon simplification using the borders to preserve topology

2013-05-02 Thread Roger Veciana i Rovira
Hello, I have the a shapefile full of polygons, and* *I want to simplify them, preserving the points they share. ogr2ogr -simplify simplifies each polygon independently, so the borders don't fit properly. Is there a way to do this with GDAL? TopoJSON format( https://github.com/mbostock/topojson),

Re: [gdal-dev] Polygon to Polyline

2012-04-08 Thread Chaitanya kumar CH
Srikanth, Use ogr2ogr with the option -nlt MULTILINESTRING http://www.gdal.org/ogr2ogr.html On Mon, Apr 9, 2012 at 10:15 AM, Srikanth wrote: > Dear All, > > I would like to convert the polygon shape file to polyline shape file. > Is there any routine for carrying out this operation ? Please gu

[gdal-dev] Polygon to Polyline

2012-04-08 Thread Srikanth
Dear All, I would like to convert the polygon shape file to polyline shape file. Is there any routine for carrying out this operation ? Please guide me. -- Regards, Srikanth ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mail

Re: [gdal-dev] Polygon assembly has failed for feature FIDN

2011-05-08 Thread Frank Warmerdam
On 11-05-08 08:28 AM, Gabriel Breahna wrote: Hello, I am receiving this error into the MS_ERRORFILE log file: msDrawMap(): Image handling error. Failed to draw layer named 'danube'. msOGRFileNextShape(): OGR error. IllegalArgumentException: Points of LinearRing do not form a closed linestring Th

[gdal-dev] Polygon assembly has failed for feature FIDN

2011-05-08 Thread Gabriel Breahna
Hello, I am receiving this error into the MS_ERRORFILE log file: msDrawMap(): Image handling error. Failed to draw layer named 'danube'. msOGRFileNextShape(): OGR error. IllegalArgumentException: Points of LinearRing do not form a closed linestring The command: $ ogrinfo 3R7D0421.000 DEPARE fo

Re: [gdal-dev] Polygon topology

2011-03-08 Thread Simon Lyngby Kokkendorff
Thanks a lot. Didn't know that GetGeometryCount did that on polygons :-) Cheers, Simon On Tue, Mar 8, 2011 at 11:51 AM, Even Rouault wrote: > Selon Mike Toews : > > > On 8 March 2011 23:22, Even Rouault > wrote: > > > Not exactly. In fact you have to use the Geometry.GetGeometryCount() > that

Re: [gdal-dev] Polygon topology

2011-03-08 Thread Even Rouault
Selon Mike Toews : > On 8 March 2011 23:22, Even Rouault wrote: > > Not exactly. In fact you have to use the Geometry.GetGeometryCount() that > > returns 1 (the exterior ring) + the number of interior rings. So > > polygon.GetGeometryCount() - 1 should return the number of interior rings > > I in

Re: [gdal-dev] Polygon topology

2011-03-08 Thread Mike Toews
On 8 March 2011 23:22, Even Rouault wrote: > Not exactly. In fact you have to use the Geometry.GetGeometryCount() that > returns 1 (the exterior ring) + the number of interior rings. So > polygon.GetGeometryCount() - 1 should return the number of interior rings I initially thought so too, except

Re: [gdal-dev] Polygon topology

2011-03-08 Thread Even Rouault
Selon Chaitanya kumar CH : > I'm sorry. I now see that this method is not exposed in the python bindings. Not exactly. In fact you have to use the Geometry.GetGeometryCount() that returns 1 (the exterior ring) + the number of interior rings. So polygon.GetGeometryCount() - 1 should return the num

Re: [gdal-dev] Polygon topology

2011-03-08 Thread Mike Toews
You could use the `interiors` length in Shapely: from osgeo import ogr from shapely.wkb import loads source = ogr.Open('my_polygons.shp') layer = source.GetLayer() feature = layer.GetNextFeature() num = 0 while feature: g = loads(feature.GetGeometryRef().ExportToWkb()) if g.geom_type == 'P

Re: [gdal-dev] Polygon topology

2011-03-08 Thread Chaitanya kumar CH
I'm sorry. I now see that this method is not exposed in the python bindings. On Tue, Mar 8, 2011 at 2:59 PM, Chaitanya kumar CH wrote: > Simon, > > You can use the OGRPolygon::getNumInteriorRings() method to get the number > of holes in an OGR polygon object. > > On Tue, Mar 8, 2011 at 2:27 PM, S

Re: [gdal-dev] Polygon topology

2011-03-08 Thread Chaitanya kumar CH
Simon, You can use the OGRPolygon::getNumInteriorRings() method to get the number of holes in an OGR polygon object. On Tue, Mar 8, 2011 at 2:27 PM, Simon Lyngby Kokkendorff wrote: > Hi List, > > I am using ogr via the python bindings to construct various polygons. > Here's just a simple quest

[gdal-dev] Polygon topology

2011-03-08 Thread Simon Lyngby Kokkendorff
Hi List, I am using ogr via the python bindings to construct various polygons. Here's just a simple question, to which someone might have some input. Is there anyway to determine the topology, i.e. the number of holes, of a polygon without e.g. having to export to WKT and examining the output st

Re: [gdal-dev] Polygon

2011-03-04 Thread Frank Warmerdam
On 11-03-04 05:02 AM, Alexandre Leclerc wrote: Anybody can help me please ? I feel that the SHPWriteObject() write a bad way in the file. Do you think it could come from compiler ? I use Borland C++ 6 When I edit the file in text editor it seems good, the length of the file is 1904 But when

Re: [gdal-dev] Polygon

2011-03-04 Thread Chaitanya kumar CH
Alexandre, Did you check the file before trying it with your application? What do you get if you run "ogrinfo -al "? On Fri, Mar 4, 2011 at 3:32 PM, Alexandre Leclerc wrote: > Anybody can help me please ? > > > > I feel that the SHPWriteObject() write a bad way in the file. > > > > Do you think

RE: [gdal-dev] Polygon

2011-03-04 Thread Alexandre Leclerc
Anybody can help me please ? I feel that the SHPWriteObject() write a bad way in the file. Do you think it could come from compiler ? I use Borland C++ 6 When I edit the file in text editor it seems good, the length of the file is 1904 But when I read file with SHPOpen() the psSHP

Re: [gdal-dev] Polygon

2011-03-03 Thread Chaitanya kumar CH
Alexandre, Can you send your code as a .cpp file as an attachment? Also, I think you should change the line Buffer[size+1]='\0'; to Buffer[size]='\0'; On Thu, Mar 3, 2011 at 6:34 PM, Alexandre Leclerc wrote: > Hello I try to draw a polygon from shapefile on geoconcept. > > > > But the points tha

[gdal-dev] Polygon(suite)

2011-03-03 Thread Alexandre Leclerc
Sorry, I forgot to tell you that I used SHPReadOGRObject for read the SHPObject. put it at the beginning of the code of previous mail SHPHandle hSHP = SHPOpen(chemin.c_str(),"rb"); SHPObject *psShape = SHPReadObject(hSHP,0); OGRGeometry *poPoly = SHPReadOGRObject(hSHP, 0,psShape);

[gdal-dev] Polygon

2011-03-03 Thread Alexandre Leclerc
Hello I try to draw a polygon from shapefile on geoconcept. But the points that I get are corrupted. Strangely a shapefile with no prj, and one ring in WGS84 works. Here I try with a prj with lambert 2 extend projection. The shapefile contains 2 rings. See my code below.

Re: [gdal-dev] Polygon area with intersection?

2010-06-07 Thread Frank Warmerdam
Rudi von Staden wrote: Hi all, I need to create a tool that will take a set of points (say in a csv file) given in WGS84 lat/long, and work out the area of the outer hull that encompasses the points. The points could be anywhere in Southern Africa. I was thinking to use the following approa

[gdal-dev] Polygon area with intersection?

2010-06-07 Thread Rudi von Staden
Hi all, I need to create a tool that will take a set of points (say in a csv file) given in WGS84 lat/long, and work out the area of the outer hull that encompasses the points. The points could be anywhere in Southern Africa. I was thinking to use the following approach (using gdal/ogr and P

Re: [gdal-dev] polygon to grid?

2009-07-13 Thread Frank Warmerdam
Lewis, Ambrose J. wrote: Hi All: I’m relatively new to GDAL/OGR, so please forgive a dumb question! I have a grid file (DTED elevations) and a shapefile of polygons (building locations and an APEX attribute representing their height). I’d like to combine these together so that my new[x,y] =

[gdal-dev] polygon to grid?

2009-07-13 Thread Lewis, Ambrose J.
Hi All: I'm relatively new to GDAL/OGR, so please forgive a dumb question! I have a grid file (DTED elevations) and a shapefile of polygons (building locations and an APEX attribute representing their height). I'd like to combine these together so that my new[x,y] = DTED elevation[x,y] + buildin