Hey Scott You gave me an idea: cut first with a region on the north hemisphere and then the south. The circle does not work as expected. In EPSG:4326 you need a rectangle. First I created different entries, adding 10000 to the fid to avoid collisions. But later I decided to just "st_collect" the polygons in a single multipolygon (per entry). The final sql is like this:
select fid, name, iso_a2, iso_a3 ,coalesce( st_collect( st_intersection( ST_GeomFromText('MULTIPOLYGON(((-180 90, -180 0, 180 0, 180 90, -180 90)))'), geom), st_intersection( ST_GeomFromText('MULTIPOLYGON(((-180 -90, -180 0, 180 0, 180 -90, -180 -90)))'), geom) ), geom) as geom from countries Thank you. On Sun, 26 Jan 2025 at 17:33, Scott via gdal-dev <gdal-dev@lists.osgeo.org> wrote: > Hey Javier, > > Maybe create 2 geometries, southern and northern hemisphere, then do an > intersection of both with your source geometries. You would have to > create new fid as the new geom's would the same fid. Untested, something > like this: > > ogr2ogr -dialect sqlite -sql @newGeom.sql target.gpkg source.gpkg > > newGeom.sql > > select > r.fid > ,r.geom > from ( > select > fid > ,st_intersection(MakeCircle(0, 90, 4326, .001), geom) as geom > from mygeoms > > union all > > select > fid > ,st_intersection(MakeCircle(0, -90, 4326, .001), geom) as geom > from mygeoms > ) r > > Hope that helps, > Scott > > On 1/26/25 02:14, Javier Jimenez Shaw via gdal-dev wrote: > > Hi > > > > I have a vector layer (like /usr/share/qgis/resources/data/ > > world_map.gpkg) and I need to add a point at latitude 0 for every > > segment (in line or polygon) that crosses the equator. > > > > How can I do it? > > > > Thanks, > > Javier. > > > > _______________________________________________ > > gdal-dev mailing list > > gdal-dev@lists.osgeo.org > > https://lists.osgeo.org/mailman/listinfo/gdal-dev > > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev >
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev