New answers tagged

1

A simple function can do that for you. Here's how: allKmlLayers <- function(kmlfile){ lyr <- ogrListLayers(kmlfile) mykml <- list() for (i in 1:length(lyr)) { mykml[i] <- readOGR(kmlfile,lyr[i]) } names(mykml) <- lyr return(mykml) } use it with: kmlfile <- "se\\file.KML" mykml <- allKmlLayers(kmlfile)


1

The syntax to use with different GDAL vector drivers varies as well as how and where the syntax is documented in the corresponding driver pages. The SQL Server driver manual page has section "Connecting to a database" with basic instruction To connect to a MSSQL datasource, use a connection string specifying the database name, with additional ...


3

If all you need to do is move the origin of your raster slightly, i.e shift the pixels, you can use the Shift tool in ArcGIS Summary Moves (slides) the raster to a new geographic location, based on x and y shift values. This tool is helpful if your raster dataset needs to be shifted to align with another data file. Illustration


3

Use layer.GetNextFeature() from osgeo import ogr driver = ogr.GetDriverByName("WFS") wfs = driver.Open("WFS:http://geodienste-hamburg.de/DE_HH_WFS_INSPIRE_A3_1_Statistische_Einheiten") # This is a public WFS with open data layer = wfs.GetLayerByName("Stadtteile") # Some polygons, possibly multipolygons # A random point inside one of them ...


0

After following all the steps in this answer (except that I did not edit any files as in step 4 and I used gdal-1.11.3) I was able to get past this issue but ran into a new problem. I see the mysql dropdown now but when I try to connect to a db I get a segmentation fault EXC_BAD_ACCESS (SIGSEGV)


1

EPSG:28992 is projected system, not geographical so you cannot call SetWellKnownGeogCS() for it. You need to define both ellipsoid (GeogCS) and projection method (ProjCS) for projected systems. For UTM projection you can set both explicitly: proj = osr.SpatialReference() proj.SetProjCS("UTM 30N (WGS84)") proj.SetWellKnownGeogCS("WGS84") proj.SetUTM(30, ...


3

The Gohlke GDAL/OGR wheel includes the FileGDB driver compiled as a plugin. To get the FileGDB driver working: Copy the Esri bin64\FileGDB.dll to [python install/virtualenv dir]\Lib\site-packages\osgeo (use bin\FileGDB.dll if using 32bit python). Do not copy the FileGDB.dll to the gdalplugins directory. Set GDAL_DRIVER_PATH environment variable, ...


3

The key information is here: I am also able to get OGR formats: ogrinfo --formats prints a bunch of them in the Windows cmd (with no FileGDB there though). This tells me that your GDAL_DRIVER_PATH environment variable is not set. See the instructions at https://trac.osgeo.org/gdal/wiki/FileGDB#Testingthedriver. Once "FileGDB" shows in ogrinfo --formats ...


1

I started it all again: restored a previous database from backup; create extension postgis; create extension postgis_topology; ogr2ogr from console creates additional tables (like waypoints); after this I need to grant access in those additional tables to php/apache user.


0

Below is the answer to my problem. hope it helps someone def findCountryByBoundingBoxOffline(coords): log = logging.getLogger(__name__) bb = getBoundingBox(coords) path = 'borders' file = os.path.join(os.path.dirname(__file__),path, 'World_Country_Borders_KML.kml') #SpatialRef = osr.SpatialReference() ...


3

What is strange if the intersection result is a point ? The intersect predicate is Returns True if the boundary and interior of the object intersect in any way with those of the other. With a common point between the geometries, the intersects predicate returns TRUE because the boundary of the first geometry intersects the boundary of the second ...


1

Not a proper answer but does not fit into the comment box. However, at least PostGIS does return a point for two polygons which touch at one point. SELECT ST_AsText( ST_Intersection(ST_GeomFromText( 'POLYGON (( 140 360, 140 480, 220 480, 220 360, 140 360 ))'), ST_GeomFromText( 'POLYGON (( 220 260, 220 360, 300 360, 300 260, 220 260 ))'))); ...


2

Figuring out the GPX driver options for rgdal is headache-inducing. Writing a linestring as you've done here will cause it to write a route layer - if you write a multilinestring it should create a track layer. According to the documentation you should be able to make it be a track layer regardless using FORCE_GPX_TRACK=true but I've not been able to make ...



Top 50 recent answers are included