Tag Info

Hot answers tagged

7

The location coordinates of your feature are stored in a geometry/shape field in the attribute table, not a text readable field you can adjust. You can store the coordinates as attributes, but they won't actually control where the point is. There are a few ways to address this: First, you could just make a table/spreadsheet/csv of your coordinate pairs. ...


6

There's some information on the OGC Call for Comments page on the new specification for coordinate reference system WKT standard. The original specification was written by Esri many moons ago for OGC based on the mid-1990s version of the EPSG Geodetic Parameter Dataset's schema. It was revised and extended by other OGC specifications. Because it was a very ...


6

I would discourage you from exporting a FeatureClass to a Shapefile. Shapefiles have lots of limitations, such as not being able to store null values and limitations fo the number of characters in a field. Often, such exports result in severe data truncation. You should read more about ShapeFile limitations here before proceeding. Once you understand the ...


6

The coordinates in the attribute table are numeric values that are not linked with the geometry. If you want to create a large number of points with exact coordinates, I suggest that you create a table with those coordinates, then use create an XY table event that you can merge with your existing shapefile. If you need to move just a few points, then ...


5

If you don't have an attribute, you should first find a polygon feature class with the boundaries of Greece (e.g. on gadm.org). Then you have two solutions : You want the roads to be cut at the boundaries of you area of interest : use some clip tools (in QGIS : Vector -> Geoprocessing -> Clip ) You want to keep the two sides of a road when it crosses a ...


5

You can use ExecuteSQL on an OGR data source to return a new layer. E.g. from osgeo import ogr ogr_ds = ogr.Open('table.shp') sql = 'SELECT DISTINCT field FROM table' layer = ogr_ds.ExecuteSQL(sql) for i, feature in enumerate(layer): print('%d: %s' % (i, feature.GetField(0))) Note that there is no geometry in the layer, since it wasn't part of the SQL ...


5

To read your shapefile, i recommend you to use rgdal package and its readOGR function, or eventually use readShapeLines from maptools package. These packages rely on the sp package as concerning how the geospatial data is structured in R. You can do easily this to convert your shapefile into data.frame (ie extract the attributes of the shapefile) ...


5

You're right Will, you have to save the features first before you can save it as a shapefile. When you toggle the editing icon to add your points, toggle it again. You should see a message come up: (Alternatively if you have the layer's attribute table loaded, you can save the features by clicking on the save icon). Now you should be able to load the ...


4

Try add Long, Lat columns after Name column in attribute table and calculate values via field calculator. When you save to CSV in save Options select GEOMETRY=Defaults (defoults this options set AS_XY) and you receive CSV file with only columns in attribute table of shapefile.


4

I like Mike Ts response (+1!). However, if you want to stick with what you have and not use sql, here's another way: feature = layer.GetNextFeature() field_vals = [] while feature: field_vals.append(feature.GetFieldAsString('FIELD_NAME')) feature = layer.GetNextFeature() #use set to get distinct field_vals print set(field_vals) note that ...


4

This is not an R solution, but Quantum GIS (QGIS) is a great way to achieve what you want. You can simply load the .osm file (Add Vector tool), right-click it in the Table of Contents and Save As ESRI Shapefile. QGIS may crash with such a large extract, so to avoid this you can uses OSM Tools like the OverPass API to download only what you need using ...


4

Reorganise your shapefile so that one shapefile contains one feature (A,B,C in your case) only Then use a loop like for i in A B C; do gdalwarp -cutline $i.shp ... $i.tif done to create each output raster. Example of script: #!/bin/sh # "shp" - folder for shapefiles # "outputraster" - folder for output rasters cd /home/user/cliprasters/ # ...


4

Have you considered using a hosted solution? These days I only roll my own, when one of the cloud based services like ArcGIS Online or Mango don't have what I need out of the box. The spec you are describing is their bread and butter. Personally I find that Mango has the best mobile client. Their pricing is also sharper than ArcGIS Online for smaller ...


3

I would use Python's itertools and a SearchCursor for a very efficient way to find the spatial relationships you are after. You can incorporate the geometry methods overlaps, contains, and equal to get at the geometry properties. Start off by creating a function to better organize the workflow and for repeatability def findOverlaps(x): Open a search ...


3

With the SQLite dialect GDAL/OGR supports everything that is supported by SQLite http://www.sqlite.org/lang.html and Spatialite http://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html. You can demonstrate how to get an ordered list of distinct attribute values with ogrinfo. For sure the same functionality is available also from python. ogrinfo test.shp ...


2

Figured this out! (also asked here) A record in a spatial table (Shapefile, PostGIS, Spatialite) that has no geometry can have geometry added by adding a 'part' to the feature using the advanced digitizing toolbar. Here's the workflow: Bring table containing the geometry-missing feature into QGIS Select the layer from the layers panel and start an edit ...


2

Try editing your table so the field names don't contain spaces, special characters etc. That's what causes the error on export to shape, and may be the root of some of the other issues you have as well...


2

DIVA GIS will give you roads and municipalities (and I think departments). OSM will give you roads, municipalities and some POIs (and I think departments). Natural Earth will give you municipalities and roads (and I think departments). GeoCommunity will give you roads, municipalities and places (and I think departments). GeoNames will give you places.


2

You can also use a polygon to select the roads you want (in the top menu bar, the icon with the white arrow and the dotted lines). Then click on the layer containing the roads >> save as shapefile. If you make sure the box 'only save selected feautures' is thicked, you're new shapefile should only contain the selected roads.


2

I have an idea what may work for you. It is going to be based off some assumptions, but it would help narrow down your list of possible identical features. This would not be an automated process, but it would require manually looking at the duplicates. Based off the comments, it seems like the automated tools don't compare attributes so this would help ...


2

@jazzurro, you perfectly can do this with R, just look up osmar package! Read the osmar documentation (osmar.r-forge.r-project.org/RJpreprint.pdf). At pages 11 pp. you can find a detailed example for extracting roads/highways by the according tags for munich.osm! After pulling and extracting the data from a planet file for Australia you can convert to any ...


2

If I understand your question correctly, it sounds like want to have three points created for each row in your table (one for each of the three fields). When ArcMap imports a table like this, it will only create one point feature for each row in your table. So if you want it to create three points per row (one for each of your fields given for each ...


2

The above code looks more like you just clone shp into shputm and then assign the output of crs(shp) to shputm without performing an actual reprojection. Anyway, if you import both the shapefile and the NDVI raster, and then reproject shp using spTransform, subsequent data extraction should work out fine. Also, the output of extent(shp_utm) roughly agrees ...


2

If the Excel sheet contains point coordinates and you want to make a shp, you first need to create an event layer. File, Add Data, Add XY data. Then you can go to Data, Export Data to create your shp.


2

when you are at the step of exporting, look at the bottom of the dialogue box and make sure the type is set to shapefile, sometimes it defaults to dbf. Hope that helps.


2

There is no such tool working 100% perfectly, because there are many EPSG codes that share the same projection parameters. You can run gdalsrsinfo on any Geotiff or shapefile .prj file to get the proj string out of the definition. For some intelligent ways of guessing, follow the answers given here: Identifying Coordinate System of Shapefile when Unknown? ...


2

Here is the source to the underlying Java library, prj2epsg, used behind the scenes on the webpage you list. Basically, it uses a Lucene index to get the best match between the WKT in your prj file and an underlying EPSG. As AndreJ has already said, this may not be 100% perfect, but Lucene excels at partial/fuzzy matching. gdalsrsinfo might be easier to get ...


2

I find openWind normally works very well so, without any further information, I suspect you are spot on about mismatched CRS. According to the documentation: openWind is fundamentally based on a meter grid so the projection only comes into play when converting to and from geographic coordinates. openWind does not carry out on-the-fly projection so ...


2

You might see both datasets aligned because On-the-fly-reprojection is enabled. This works when both datasets have different CRS. Other software does not offer this tool, so you have to reproject one of your datasets to the CRS of the other to make them align in every software. BTW this applies also to some tools integrated in QGIS, like intersection or ...


2

With your example, polygon is a standard Python dict object that represents a GeoJSON geometry, which only uses standard data types, with no fancy geospatial properties. But you can convert polygon into a shapely geometry, as you have done with shape polygon = shapefile_record['geometry'] shape = shapely.geometry.asShape(polygon) print(shape.bounds)



Only top voted, non community-wiki answers of a minimum length are eligible