[gdal-dev] python - convert CSV of point coordinates to geopackage

Thomas Gratier osgeo.mailinglist at gmail.com
Fri Jun 17 17:36:18 PDT 2022


Hi,

One possible approach using only GDAL
https://gist.github.com/ThomasG77/1c76c8fd4f6ee08d9da88dfdb911cfcb
It can be also made with higher level abstraction package like geopandas or
fiona like mentioned by Alan (also in the same link)


Regards

Thomas Gratier

PS: not sure I've code the fastest solution for 3 approaches


Le ven. 17 juin 2022 à 02:48, Alan Snow <alansnow21 at gmail.com> a écrit :

> These references may be helpful:
>
> https://geopandas.org/en/stable/docs/user_guide/io.html
>
>
> https://geopandas.org/en/stable/docs/reference/api/geopandas.points_from_xy.html
>
>
> On Thu, Jun 16, 2022, 7:14 PM Emily Soth <esoth at stanford.edu> wrote:
>
>> Hi,
>>
>> I am trying to create a geopackage from a CSV of point coordinates making
>> use of the X_POSSIBLE_NAMES and Y_POSSIBLE_NAMES open options on the CSV
>> driver.
>>
>> I have tried a few things (details are in a gist
>> <https://gist.github.com/emlys/60db94cb4017a78219a1aa1dadc0914d>). To
>> summarize, I can only set the open options when opening as a gdal.Dataset,
>> but then I cannot copy that back into a vector format.
>>
>> In the source code it looks like open options can be passed to the CSV
>> driver's Open function (source
>> <https://github.com/OSGeo/gdal/blob/35c07b18316b4b6d238f6d60b82c31e25662ad27/ogr/ogrsf_frmts/csv/ogrcsvdriver.cpp#L142-L167>)
>> but I don't know how to use this from the python API since the python
>> ogr.Driver.Open function doesn't accept open options unlike gdal.OpenEx.
>>
>> Thank you!
>> - Emily
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220618/dd287caa/attachment.htm>


More information about the gdal-dev mailing list