Closed bwcastillo closed 1 year ago
R package sf
uses the GDAL library for this; to sort out whether the problem is with sf
or with GDAL
I would try to obtain the data with a call to the (command line tool) ogr2ogr
, trying to save the dataset to a local file, like a GPKG or so.
Thank you @edzer! I will try to reach out where the problem is coming from.
@edzer,
Finally I verified that is a GDAL problem, I did my test in local and it worked:
ogr2ogr -f GPKG output.gpkg nypd-arrest-historic.geojson
But when I used the url where is the geojson file it didn't recognize it:
ogr2ogr -f PostgreSQL PG:"host=localhost dbname=censos user=postgres password=adminpass port=5432 schemas=censos ACTIVE_SCHEMA=censos" -lco SCHEMA=censos https://data.cityofnewyork.us/resource/8h9b-rp9u.geojson?%24limit=5308876^&%24%24app_token=TOKENCODE -lco GEOMETRY_NAME=geometry
ERROR 1: Failed writing body (0 != 16384)
FAILURE:
Unable to open datasource `https://data.cityofnewyork.us/resource/8h9b-rp9u.geojson?%24limit=5308876&%24%24app_token=TOKENCODE' with the following drivers.
-> `JP2ECW'
-> `OCI'
-> `SOSI'
-> `PCIDSK'
-> `netCDF'
-> `PDS4'
-> `VICAR'
-> `JP2OpenJPEG'
-> `PDF'
-> `MBTiles'
-> `EEDA'
-> `DB2ODBC'
-> `ESRI Shapefile'
-> `MapInfo File'
-> `UK .NTF'
-> `OGR_SDTS'
-> `S57'
-> `DGN'
-> `OGR_VRT'
-> `REC'
-> `Memory'
-> `BNA'
-> `CSV'
-> `NAS'
-> `GML'
-> `GPX'
-> `LIBKML'
-> `KML'
-> `GeoJSON'
-> `GeoJSONSeq'
-> `ESRIJSON'
-> `TopoJSON'
-> `Interlis 1'
-> `Interlis 2'
-> `OGR_GMT'
-> `GPKG'
-> `SQLite'
-> `ODBC'
-> `WAsP'
-> `PGeo'
-> `MSSQLSpatial'
-> `OGR_OGDI'
-> `PostgreSQL'
-> `MySQL'
-> `OpenFileGDB'
-> `XPlane'
-> `DXF'
-> `CAD'
-> `FlatGeobuf'
-> `Geoconcept'
-> `GeoRSS'
-> `GPSTrackMaker'
-> `VFK'
-> `PGDUMP'
-> `OSM'
-> `GPSBabel'
-> `SUA'
-> `OpenAir'
-> `OGR_PDS'
-> `WFS'
-> `OAPIF'
-> `HTF'
-> `AeronavFAA'
-> `Geomedia'
-> `EDIGEO'
-> `SVG'
-> `CouchDB'
-> `Cloudant'
-> `Idrisi'
-> `ARCGEN'
-> `SEGUKOOA'
-> `SEGY'
-> `XLS'
-> `ODS'
-> `XLSX'
-> `Elasticsearch'
-> `Walk'
-> `Carto'
-> `AmigoCloud'
-> `SXF'
-> `Selafin'
-> `JML'
-> `PLSCENES'
-> `CSW'
-> `VDV'
-> `GMLAS'
-> `MVT'
-> `NGW'
-> `MapML'
-> `TIGER'
-> `AVCBin'
-> `AVCE00'
-> `HTTP'
If I copy the Unable to open datasource that the output refers, in a browser it works. So, it makes me to conclude that is GDAL problem.
I don't know if I can post this in any GDAL forum.
Thanks in advance.
PS: the subtle difference '^' between the url input and output is because treat '&' as special character in the input url.
Have you tried to put /vsicurl/
in front of the dataset starting with https://...
, like /vsicurl/https://data.cityofnewyork.us/resource/8h9b-rp9u.geojson?%24limit=5308876^&%24%24app_token=TOKENCODE
?
Now, I tried but it didn't work, also I tried with ogrinfo
and neither.
Same last query with vsicurl:
C:\>ogr2ogr -f PostgreSQL PG:"host=localhost dbname=censos user=postgres password=adminpass port=5432 schemas=censos ACTIVE_SCHEMA=censos" -lco SCHEMA=censos /vsicurl/https://data.cityofnewyork.us/resource/8h9b-rp9u.geojson?%24limit=530887^&%24%24app_token=TOKENCODE -lco GEOMETRY_NAME=geometry
Warning 1: HTTP response code on https://data.cityofnewyork.us/resource/8h9b-rp9u.geojson?%24limit=530887&%24%24app_token=TOKENCODE: 403
FAILURE:
Unable to open datasource `/vsicurl/https://data.cityofnewyork.us/resource/8h9b-rp9u.geojson?%24limit=530887&%24%24app_token=TOKENCODE' with the following drivers.
-> `JP2ECW'
-> `OCI'
-> `SOSI'
-> `PCIDSK'
-> `netCDF'
-> `PDS4'
-> `VICAR'
-> `JP2OpenJPEG'
-> `PDF'
-> `MBTiles'
-> `EEDA'
-> `DB2ODBC'
-> `ESRI Shapefile'
-> `MapInfo File'
-> `UK .NTF'
-> `OGR_SDTS'
-> `S57'
-> `DGN'
-> `OGR_VRT'
-> `REC'
-> `Memory'
-> `BNA'
-> `CSV'
-> `NAS'
-> `GML'
-> `GPX'
-> `LIBKML'
-> `KML'
-> `GeoJSON'
-> `GeoJSONSeq'
-> `ESRIJSON'
-> `TopoJSON'
-> `Interlis 1'
-> `Interlis 2'
-> `OGR_GMT'
-> `GPKG'
-> `SQLite'
-> `ODBC'
-> `WAsP'
-> `PGeo'
-> `MSSQLSpatial'
-> `OGR_OGDI'
-> `PostgreSQL'
-> `MySQL'
-> `OpenFileGDB'
-> `XPlane'
-> `DXF'
-> `CAD'
-> `FlatGeobuf'
-> `Geoconcept'
-> `GeoRSS'
-> `GPSTrackMaker'
-> `VFK'
-> `PGDUMP'
-> `OSM'
-> `GPSBabel'
-> `SUA'
-> `OpenAir'
-> `OGR_PDS'
-> `WFS'
-> `OAPIF'
-> `HTF'
-> `AeronavFAA'
-> `Geomedia'
-> `EDIGEO'
-> `SVG'
-> `CouchDB'
-> `Cloudant'
-> `Idrisi'
-> `ARCGEN'
-> `SEGUKOOA'
-> `SEGY'
-> `XLS'
-> `ODS'
-> `XLSX'
-> `Elasticsearch'
-> `Walk'
-> `Carto'
-> `AmigoCloud'
-> `SXF'
-> `Selafin'
-> `JML'
-> `PLSCENES'
-> `CSW'
-> `VDV'
-> `GMLAS'
-> `MVT'
-> `NGW'
-> `MapML'
-> `TIGER'
-> `AVCBin'
-> `AVCE00'
-> `HTTP'
With ogrinfo
C:\>ogrinfo -ro -al -so /vsicurl/http://data.cityofnewyork.us/resource/8h9b-rp9u.geojson?%24limit=530887^&%24%24app_token=TOKENCODE
Warning 1: HTTP response code on http://data.cityofnewyork.us/resource/8h9b-rp9u.geojson?%24limit=530887&%24%24app_token=TOKENCODE: 403
FAILURE:
Unable to open datasource `/vsicurl/http://data.cityofnewyork.us/resource/8h9b-rp9u.geojson?%24limit=530887&%24%24app_token=TOKENCODE' with the following drivers.
-> JP2ECW
-> OCI
-> SOSI
-> PCIDSK
-> netCDF
-> PDS4
-> VICAR
-> JP2OpenJPEG
-> PDF
-> MBTiles
-> EEDA
-> DB2ODBC
-> ESRI Shapefile
-> MapInfo File
-> UK .NTF
-> OGR_SDTS
-> S57
-> DGN
-> OGR_VRT
-> REC
-> Memory
-> BNA
-> CSV
-> NAS
-> GML
-> GPX
-> LIBKML
-> KML
-> GeoJSON
-> GeoJSONSeq
-> ESRIJSON
-> TopoJSON
-> Interlis 1
-> Interlis 2
-> OGR_GMT
-> GPKG
-> SQLite
-> ODBC
-> WAsP
-> PGeo
-> MSSQLSpatial
-> OGR_OGDI
-> PostgreSQL
-> MySQL
-> OpenFileGDB
-> XPlane
-> DXF
-> CAD
-> FlatGeobuf
-> Geoconcept
-> GeoRSS
-> GPSTrackMaker
-> VFK
-> PGDUMP
-> OSM
-> GPSBabel
-> SUA
-> OpenAir
-> OGR_PDS
-> WFS
-> OAPIF
-> HTF
-> AeronavFAA
-> Geomedia
-> EDIGEO
-> SVG
-> CouchDB
-> Cloudant
-> Idrisi
-> ARCGEN
-> SEGUKOOA
-> SEGY
-> XLS
-> ODS
-> XLSX
-> Elasticsearch
-> Walk
-> Carto
-> AmigoCloud
-> SXF
-> Selafin
-> JML
-> PLSCENES
-> CSW
-> VDV
-> GMLAS
-> MVT
-> NGW
-> MapML
-> TIGER
-> AVCBin
-> AVCE00
-> HTTP
OK, now your task is to sort out whether this is supposed to work the way you do it, or whether this is a feature request, really, and find the appropriate place to post it. I think we can close here.
@edzer
I was wondering how sf::st_read
works, because it allows me to read 3M from an api/url but not 4M, also with ogr2ogr
I couldn't get any data.
Thank you !
Hello,
I am trying to load a database from NY Open Data -5.8M rows - to PostGIS, using
st_write()
method. I am having different responses when I define the limit -number of rows- parameter in the url/api. If I define =<3M or >3, in the first case (=3M) it works, but when I set up 4M it doesn't work and returnError: Cannot open "https://data.cityofnewyork.us/resource/8h9b-rp9u.geojson?%24limit=4000000&%24%24app_token=MyToken"; The file doesn't seem to exist. GDAL Error 1: Failure writing output to destination
, but if I copy and open the link in the browser it works.What can be the reason?
Thanks in advance.