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
1
vote
1 answer

Cannot open OGR file

I have already tried re-writing this code using dsn=path.expand and shapefile. However, this keeps giving me an error. mapfile <-readOGR("/Users/kajoribanerjee/Documents/PhD/bayesian geoadditive model/india_2011.shp") Error in ogrListLayers(dsn =…
1
vote
3 answers

Find indices of raster cells that intersect with a polygon

I want to get a list of indices (row,col) for all raster cells that fall within or are intersected by a polygon feature. Looking for a solution in python, ideally with gdal/ogr modules. Other posts have suggested rasterizing the polygon, but I would…
corvus
  • 556
  • 7
  • 18
1
vote
1 answer

No module named 'ogr'

I followed this tutorial (https://gis.stackexchange.com/a/124420) to install gdal in a virtualenv. It seemed to work since I didn't get No module named 'osgeo' anymore when trying to import gdal. But now I'm getting this error: File…
1
vote
1 answer

Number of segments in SpatialLinesDataFrame

After importing a spatial lines dataframe with readOGR, I would like to determine the number of line segments (nodes) in each line. I cannot find a practical way to simply export the lengths as a vector. routes@lines will get me to the line…
iskandarblue
  • 7,208
  • 15
  • 60
  • 130
1
vote
1 answer

Unable to load PROJ.4 library

l m following a book and l type the example code but when l run it, it gave these errors.l m using Enthought Canopy along with all necessary packages. how can l solve this problem? l do not want to use another package as there are some other steps…
ömer sarı
  • 639
  • 1
  • 10
  • 30
1
vote
1 answer

mapnik markers dont always appear

I'm using mapnik 2.2.0 from Python on Ubuntu 16.04. I load OSM data and a layer of points from a csv file. The points in the csv file are in epsg:4326. Different points appear or disappear depending on the size of the map. The points that don't…
user2333312
  • 101
  • 1
  • 9
1
vote
0 answers

How to Compile GPX Read Support into a C# Project (Using OGR/GPX Driver)?

When I throw the path to a GPX file to OSGeo.OGR.Ogr.Open(), I get null back instead of a populated DataSource. In my situation, I believe this is happening because I'm not building my OGR/GPX driver with read support (that's what my log file says,…
1
vote
1 answer

How to copy the spatial reference from a shapefile to a geotiff raster?

I have constructed a python script that constructs a geotiff raster from a shapefile. At present the geotiff produced does not contain the spatial reference of the shapefile. How do I copy the spatial reference from the shapefile to the geotiff? …
Philip Whitten
  • 293
  • 2
  • 16
1
vote
1 answer

OGR SQL Server to GeoJSON

I am having some issues converting a SQL table to GeoJSON. This is my connection string: ogr2ogr -f "GeoJSON" "test.geojson" "MSSQL:server=(LocalDb)\v11.0;database=SpatialDataExamples;tables=test;trusted_connection=yes;Integrated…
Ian Short
  • 59
  • 8
1
vote
2 answers

Why can't PHP insert new geometry on PostGIS?

I'm using ogr2ogr to upload a GPX file to PostGIS. When I do it on command line (Ubuntu 14.04), it works fine. ogr2ogr -append -f PostgreSQL PG:"host=... dbname=... user=... password=..." 2016-04-26_15-32-01.xml When I do it on PHP…
Rodrigo
  • 4,706
  • 6
  • 51
  • 94
1
vote
1 answer

Methods of Merging layers/shapefiles using OGR in python

I am new to python and am trying to get more comfortable automating GIS tasks with python. Any help is appreciated I have two layers containing points that I am trying to merge together into one single layer, using Ogr in python. Below is code I…
rob445766
  • 33
  • 1
  • 4
1
vote
1 answer

Shapefile created with GDAL doesn't hold projection

I'm generating a shapefile using the GDAL and shapely libraries in Python. There's a problem with the projection, when I import the resulting shapefile in ArcMap, there is not projection associated with the file. How can I correct that, or how can I…
kaycee
  • 901
  • 1
  • 9
  • 35
1
vote
2 answers

How to import OSM polygons data from PostGIS to R?

I am new to the world of spatial analysis using R. Using this link I have downloaded OSM data in .osm.pbf format. Then I used osm2pgsql tool to get data in PostgreSQL (PostGIS extension). Now I have several tables in my database and I want to access…
Amir
  • 685
  • 3
  • 13
  • 36
1
vote
1 answer

Python (Maybe Shapely) to create a buffer and count points

I'm trying to do a fairly simple analysis by buffering points (SEPTA subway stations [below]) and counting the number of 'incidents' (also points) that lie within the buffer. That's it. I've done some looking online, but I can't find anything…
1
vote
0 answers

How to prevent ogr2ogr from producing complex polygons

I use ogr2ogr to import a shapefile in a sqlserver database. It works fine but the geometries inserted in the database are composed of polygons with holes (interior rings) whereas in the source shapefile geometries are composed of polygons without…
mvera
  • 904
  • 12
  • 23