ogr

No module named ogr

扶醉桌前 提交于 2020-07-03 12:59:11
问题 I'm trying to use ogr module, I tried to install it with pip got the errors : Could not find a version that satisfies the requirement ogr (from versions: ) No matching distribution found for ogr tried to install all the package including GDAL and still getting an error "No module named ogr . didn't find a working solution on google. That's the code i'm trying to run: import ogr,csv,sys import shapefile shpfile=sys.argv[1] # csvfile=r'C:\Temp\test.csv' #sys.argv[2] #Open files csvfile=open(

How to load all fields/ExtendedData (not just 'name' and 'description') from KML layer into R

浪子不回头ぞ 提交于 2020-02-28 23:45:53
问题 I've been working on loading KML files into R to make web maps with Leaflet/Shiny. The import is pretty simple (using this sample KML): library(rgdal) sampleKml <- readOGR("D:/KML_Samples.kml", layer = ogrListLayers("D:/KML_Samples.kml")[1]) In this example, ogrListLayers pulls in all of the kml layers, and I subset only the first element/layer. Easy peasy. The problem is that using this method to read KML layers only pulls in two fields: "Name" and "Description," as seen below: > sampleKml <

Adding custom Feature attributes to ESRI Shapefile with Python

孤街醉人 提交于 2020-01-01 05:16:11
问题 I am seeking a way to take an existing ESRI Shapefile that has a Feature set of 200 countries. Each country Feature has an attribute of "NAME." My objective is to create a Python script that adds an arbitrary (for now) additional attribute, say, "POPULATION". Of course I have the OSGeo and GeoDjango modules installed. I'm as far as: from osgeo import ogr infile = ogr.Open('sample.shp', 1) #'sample.shp' is a pre-existing ESRI shapefile described above inlyr = infile.GetLayerByIndex(0) Am I

PHP GDAL/OGR library usage, which approach is cleaner?

女生的网名这么多〃 提交于 2020-01-01 03:28:22
问题 I will be using gdal/ogr for a new project. I want a lean but fully functional app, so will not be using other implementations such as mapserver, because they have extraneous components that I doubt will be needed in the application, even in the future. For the record, it is a GIS, but I am asking here on SO because there as so few examples of a GIS in php that uses GDAL/OGR I basically have three options in mind: use php's exec() function to run command line conversion utilities Use swig to

readOGR() cannot open file

给你一囗甜甜゛ 提交于 2019-12-17 17:44:27
问题 wmap <- readOGR(dsn="~/R/funwithR/data/ne_110m_land", layer="ne_110m_land") This code is not loading the shape file and error is generated as Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, : Cannot open file I am sure that the directory is correct one. At the end / is also not there and layer name is also correct. Inside the ne_110m_land directory files I have are: ne_110m_land.dbf ne_110m_land.prj ne_110m_land.shp ne_110m_land.shx ne_110m_land.VERSION

Create a well-behaved iterator for a write-to-pointer API

断了今生、忘了曾经 提交于 2019-12-12 04:45:20
问题 I have to create an iterator for an API that features old-style "write-out to pointer" accessors only. The API in question is OGR's; one of the classes in question is OGRLineString (For reference: http://www.gdal.org/classOGRLineString.html). This class stores a number of points, which can be accessed using the following getter method: void OGRLineString::getPoint(int pos, OGRPoint *out) In order to use the accessor one creates a new OGRPoint object and passes the pointer to it to the method,

Find lat/long coordinates from pixel point in .geotiff using python and gdal

折月煮酒 提交于 2019-12-11 14:32:03
问题 I have points defined by pixel coordinates in a .geotiff imagesat. I am trying to convert these pixel coordinates into longitude and latitude. At first a tried to adapt the given code from the inverse question i previously asked here def pixel_to_world(geo_matrix, x, y): ul_x = geo_matrix[0] ul_y = geo_matrix[3] x_dist = geo_matrix[1] y_dist = geo_matrix[5] _x = x * x_dist + ul_x _y = y * y_dist + ul_y return (_x, _y) def build_transform_inverse(dataset, EPSG): source = osr.SpatialReference

Can't get Python IDLE to recognize OGR/GDAL Module

落花浮王杯 提交于 2019-12-11 02:19:01
问题 Folks, Just getting started using OGR and Python for a variety of geospatial tasks. I'm working outside of OSGEO4w, and have installed GDAL w/ Python Bindings as well as Python v. 2.7.8 on my machine. That said, I can run python and import gdal from a command-line interface but am unable to import the module when I use the IDLE environment. It returns an error telling me that the module doesn't exist. My install must be sound given that it works in the cmd prompt, so what's the deal? This is

ndk-build undefined reference errror

房东的猫 提交于 2019-12-08 05:28:57
问题 I'm using ndk-build to build a set of shared library(.so) for my android project. I configured and made the source code of C++ library(gdal-2.2.2). everything was ok.("./configure & make & make install" was successful). So i created my jni folder like this documentation. but when I'm trying to use ndk-build on windows, I get a lot of error like "Undefined refrence to somthing". I've spent a lot of time on this project. Is there someone to help me? Thanks. Update I used configure like this on

Parsing osm.pbf data using GDAL/OGR python module

断了今生、忘了曾经 提交于 2019-12-07 12:59:32
问题 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 store pubs pubs = [] for feat in layer: if feat.GetField('amenity') == 'pub': pubs.append(feat) While this little bit of code works fine with small.pbf files (15mb). However, when parsing files larger than 50mb I get the following error: ERROR 1: Too