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