osgeo

Geo Django GDAL Exception OGR Failure

拥有回忆 提交于 2020-02-16 10:42:10
问题 I'm using geo django and running on windows. I do have GDAL and OSGEOS configured in the settings. Here is my settings.py code for gdal. import os if os.name == 'nt': import platform OSGEO4W = r"C:\OSGeo4W" if '64' in platform.architecture()[0]: OSGEO4W += "64" assert os.path.isdir(OSGEO4W), "Directory does not exist: " + OSGEO4W os.environ['OSGEO4W_ROOT'] = OSGEO4W os.environ['GDAL_DATA'] = OSGEO4W + r"\share\gdal" os.environ['PROJ_LIB'] = OSGEO4W + r"\share\proj" os.environ['PATH'] =

Geo Django GDAL Exception OGR Failure

左心房为你撑大大i 提交于 2020-02-16 10:40:09
问题 I'm using geo django and running on windows. I do have GDAL and OSGEOS configured in the settings. Here is my settings.py code for gdal. import os if os.name == 'nt': import platform OSGEO4W = r"C:\OSGeo4W" if '64' in platform.architecture()[0]: OSGEO4W += "64" assert os.path.isdir(OSGEO4W), "Directory does not exist: " + OSGEO4W os.environ['OSGEO4W_ROOT'] = OSGEO4W os.environ['GDAL_DATA'] = OSGEO4W + r"\share\gdal" os.environ['PROJ_LIB'] = OSGEO4W + r"\share\proj" os.environ['PATH'] =

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

十年热恋 提交于 2020-01-25 08:59:26
问题 I have (lat,long) coordinate describing the position of a point in a .geotiff image. I wish to find the equivalent pixel coordinates of the lat,long ones inside the image. I succeded using gdaltransform from the command line with the following instruction : gdaltransform -i -t_srs epsg:4326 /path/imagename.tiff -17.4380493164062 14.6951949085676 But i would like to retrieve such type of equivalence from python code. I tried the following : from osgeo import osr source = osr.SpatialReference()

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

How to project and resample a grid to match another grid with GDAL python?

徘徊边缘 提交于 2019-12-18 10:23:10
问题 Clarification: I somehow left out the key aspect: not using os.system or subprocess - just the python API. I'm trying to convert a section of a NOAA GTX offset grid for vertical datum transformations and not totally following how to do this in GDAL with python. I'd like to take a grid (in this case a Bathymetry Attributed Grid, but it could be a geotif) and use it as the template that I'd like to do to. If I can do this right, I have a feeling that it will greatly help people make use of this

GeoTools: How to build a point? (imports issue)

╄→гoц情女王★ 提交于 2019-12-13 07:39:37
问题 I'm following the GeoTools documentation and found this: GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); Coordinate coord = new Coordinate(45, 15); Point point = geometryFactory.createPoint(coord); When I put it in intellij IDE, for each class there are several suggested imports to use. What import I need to select? Alternative way (with same issue) is: GeometryBuilder builder = new GeometryBuilder(DefaultGeographicCRS.WGS84); Point point = builder.createPoint(45,

Adding custom Feature attributes to ESRI Shapefile with Python

这一生的挚爱 提交于 2019-12-03 14:48:53
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 missing an OGR function that will allow me to insert Feature attribute fields into an existing Shapefile?

How to project and resample a grid to match another grid with GDAL python?

て烟熏妆下的殇ゞ 提交于 2019-11-29 20:31:19
Clarification: I somehow left out the key aspect: not using os.system or subprocess - just the python API. I'm trying to convert a section of a NOAA GTX offset grid for vertical datum transformations and not totally following how to do this in GDAL with python. I'd like to take a grid (in this case a Bathymetry Attributed Grid, but it could be a geotif) and use it as the template that I'd like to do to. If I can do this right, I have a feeling that it will greatly help people make use of this type of data. Here is what I have that is definitely not working. When I run gdalinfo on the resulting