Tag Info

New answers tagged

0

With GDAL and other Proj4 based programs it is handy to define the projection by its EPSG code shortcut like "epsg:28992". Shortcut is converted to actual Proj4 projection string by doing a lookup into proj installation files. Unfortunately there are lots of projections with several different projection definitions hanging aroud. Most typical case is that ...


0

ptrv/gpx2spatialite does this remarkably well, saving timestamps for all points and deriving speed and length data for tracks. It also won't import duplicate tracks, so you can feed it a huge pile for GPX files and it will munge them appropriately. Update: usage examples, as requested: Initialize new database: gpx2spatialite_create_db db.sqlite Add a ...


2

This code works for creating an OGRDataSource. Special thanks to Michael Miles-Stimson for getting me on the right track. const char* path = "C:/Test/test.shp"; OGRRegisterAll(); OGRDataSource *hDS; OGRSFDriver *driver; OGRSFDriverRegistrar *registrar = OGRSFDriverRegistrar::GetRegistrar(); driver = registrar->GetDriverByName("ESRI Shapefile"); hDS = ...


3

You're trying to use an OGR (vector) driver with GDAL (raster) tools. Here's a few lines of my working code that may help: char* BasePath = new char[FullPathMax]; // this does have a value before it's used OGRRegisterAll(); OGRDataSource *hDS = NULL; OGRSFDriver *Driver = NULL; hDS = OGRSFDriverRegistrar::Open(BasePath,FALSE,&Driver); As you can ...


0

If you are a windows user, you can find plenty usefull binaries , I am working with these and they are working very well... Good luck, cheers


0

Only adding this because I tried using the kyng chaos tools, but on my Mac OS X machine I was able to very, very easily install this with Anaconda... conda install gdal. Posting in case anyone finds this again - I realize the original post is 3 years old.


0

I solved a similar problem with homebrew rgdal by brew uninstall gdal brew install gdal --complete --with-postgresql in terminal, then installing gdal from CRAN back in R. The ogrDrivers() now displays PostgreSQL and I can successfully import PostGIS views and tables with readOGR().


5

I had to solve the same problem today, so here is my answer, which gives a complete solution: I have a lineWKT.csv file stored in F:\Data\ folder, with the data like this: id,gm 0,"LINESTRING (30 10 0, 10 30 0, 40 40 5)" I have a vrt file like this: <OGRVRTDataSource> <OGRVRTLayer name="lineWKT"> ...


1

I ran into this exact problem because I hadn't extracted the zip file into the working directory. I was rushing to get the files converted and when I checked to make sure they were there, the "preview" that I got when I double-clicked on the zipped file tricked me into thinking they were available for conversion. Even if this wasn't the solution to your ...


2

do you mean a line geometry? something like: import numpy as np from osgeo import ogr v=np.array([[[[-10885205.10690245,3525662.26531131], [-10885369.01690829,3525374.0741439], [-10885424.08206484,3525269.35422813], [-10885439.88685361,3525278.66051977], [-10885600.07792469,3525092.02164548], ...


0

I found a good blog post that provides another solution that worked in my case: http://linfiniti.com/2013/02/installing-python-gdal-into-a-python-virtualenv-in-osx/ The only difference to the blog post is that I had to do is to download the correct version of GDAL that matched the kyngchaos packages. In my case I was using the GDAL framework version 1.10, ...


1

This seems to work for me: def createLayer(fp,layer): driver = ogr.GetDriverByName("ESRI Shapefile") data_source = driver.CreateDataSource(fp) srs = osr.SpatialReference() srs.ImportFromEPSG(4326) return(data_source.CreateLayer(layer, srs, ogr.wkbPoint),data_source) layer,ds=createLayer('MyLayer.shp','MyLayer') field_name = ...


1

perhaps not as much an answer as a workaround? not sure what is going on with GetNextFeature in conjunction with SetFeature - but it would not iterate as expected. (a bug?) the below workaround seems to do the trick - by first getting a list of all feature FID's - then using GetFeature() in a new loop. def updatePt(): print 'updating...' ...



Top 50 recent answers are included