[gdal-dev] adding points to geometries

Scott public at postholer.com
Sun Jan 26 08:33:03 PST 2025


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 at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list