Questions tagged [ogr]

The OGR Simple Features Library is a C++ open source library (and commandline tools) providing read (and sometimes write) access to a variety of vector file formats including ESRI Shapefiles, S-57, SDTS, PostGIS, Oracle Spatial, and Mapinfo mid/mif and TAB formats. OGR is a part of the GDAL library

The OGR Simple Features Library is a C++ open source library (and commandline tools) providing read (and sometimes write) access to a variety of vector file formats including ESRI Shapefiles, S-57, SDTS, PostGIS, Oracle Spatial, and Mapinfo mid/mif and TAB formats.

OGR is a part of the GDAL library

212 questions
3
votes
0 answers

How can I use /viscurl/ in gdal python to load an Open Data url into posgres?

I am trying to load an Open Data dataset into a postgres database using GDAL Python binding. I have successfully written code to load in remote files from places like github and ftp servers but gdal consistently gives me errors when trying to load…
3
votes
1 answer

Parallel spatial processing based on GDAL/OGR with spatial filter using python?

I'm applying a spatial filter sequentially with GDAL/OGR in Python in order to calculate a point density: point = ogr.Geometry(ogr.wkbPoint) point.AddPoint(xCoord, yCoord) searchArea =…
Marcel Gangwisch
  • 8,856
  • 4
  • 23
  • 32
3
votes
2 answers

gdaltools exports geojson point as multipoint

I have some python code that uses gdaltools python module to convert a geojson file to postgis. ogr = gdaltools.ogr2ogr() ogr.set_encoding("UTF-8") print("Setting Input") ogr.set_input(file_name, srs="EPSG:4326") gdaltools.Wrapper.BASEPATH =…
jpc2000
  • 51
  • 5
3
votes
1 answer

readOGR cannot open layer error

I'm going through Leaflet tutorial and I have stumbled upon file loading error which reads as follows: Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, : Cannot open data source The code that leads to…
balkon16
  • 1,338
  • 4
  • 20
  • 40
3
votes
1 answer

Convert GeoJson with CRS "name": "urn:ogc:def:crs:OGC:1.3:CRS84" to Google Map lat/long

Currently I am looking a solution to convert geojson file to correct lat-long on google map as below: well.geojson: { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name":…
Mankeomorakort
  • 1,451
  • 1
  • 22
  • 36
3
votes
1 answer

Type error: reading ESRI shapefile driver using OGR/GDAL in Python

I'm trying to use gdal_polygonize within Python to convert a raster to a shapefile using the following code: # define output shapefile driver_name = "ESRI Shapefile" drv = ogr.GetDriverByName(driver_name) dst_ds =…
FClubb
  • 137
  • 1
  • 5
3
votes
1 answer

Parsing osm.pbf data using GDAL/OGR python module

I'm trying to extract data from an OSM.PBF file using the python GDAL/OGR module. Currently my code looks like this: import gdal, ogr osm = ogr.Open('file.osm.pbf') ## Select multipolygon from the layer layer = osm.GetLayer(3) # Create list to…
S Hook
  • 71
  • 1
  • 5
3
votes
2 answers

Storing OGRPoint in Boost.Geometry rtree

I'm trying to register the OGR geometry classes with Boost.Geometry to ultimately use them in a Boost.Geometry RTree. To that end, I've followed the tutorial/example in the Boost.Geometry documentation and registered OGRPoint using the…
Technaton
  • 944
  • 4
  • 15
3
votes
1 answer

WKT Equivalent of Local Projection

I am trying to use gdal to project some basic shapes from a number of local coordinate systems. These coordinate systems are supported by ArcGIS, but ultimately I am just tyring to use gdal(and proj4) to convert these geometries to basic lat/long…
BlairD
  • 31
  • 2
3
votes
1 answer

Convert .dbf .prj .shp .shx to GeoJson

I have all those files containing data and i want to convert all the data into a single geojson file. I am trying to do it like so: ogr2ogr -f GeoJSON -s_srs pga.prj pga.geojson pga.shp but i think it's not doing what it should. I do get a…
Liviu
  • 1,023
  • 2
  • 12
  • 33
3
votes
1 answer

Creating GeoJson from csv: How do I set geometry properties?

I have a csv file that I want to convert to GeoJson. lon,lat,val,id -97.1589432,25.9642008,0,2690 -97.1682294,25.9761856,0,2691 -97.1775156,25.9881704,0,2692 I run the following ogr2ogr command ogr2ogr -f GEOJson geo_result.json source.csv and I…
GrantE
  • 159
  • 1
  • 7
3
votes
2 answers

create a shape file

I want to create a shapefile (a line) using 2 points. i have the following script: import ogr, sys, os line=ogr.Geometry(ogr.wkbLineString) line.AddPoint(10,10) line.AddPoint(20,20) driver=ogr.GetDriverByName('ESRI…
user1794648
  • 31
  • 1
  • 3
3
votes
1 answer

How to register OGRLineString as boost linestring?

I would like to use the boost::geometry::simplify method with OGRLineStrings. While I am able to register the OGRPointvia the macro: BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET(OGRPoint, double, cs::cartesian, OGRPoint::getX, OGRPoint::getY,…
Hennaldo
  • 155
  • 6
2
votes
1 answer

GeoDjango / GDAL : Wrong data field being stored

I've been using GeoDjango for a few months now without any issues however when importing a new shape file the id number is being saved instead of the gridcode. The gridcode field has an int that is valuable to my project. I know the gridcode field…
Display name
  • 753
  • 10
  • 28
2
votes
0 answers

Why is subsetting in sf removing some geometry?

I'm cleaning an sf file using package sf. When I write out the file using write_sf, all of the geometry is there. But when I read it back in using readOGR, it reports: "Dropping null geometries" and drops 430 lines. I need to read it back in with…
1 2
3
14 15