Tag Info

Hot answers tagged

5

You can do this using 2 os.path functions (splitext and basename): import os os.path.splitext(os.path.basename(r'C:\user\shapefiles\polygon.shp'))[0] # returns 'polygon'


4

The "Phantom" feature likely is an invalid one, you should try to make valid it. To fix the feature you can: use the Check Geometry tool (Vector->Geometry tools->Check Geometry Validity). This allows you to find invalid geometries. In this case you have to fix the feature manually by editing it. use the Processing LWGEOM plugin: ...


4

Excellent answers provided by @ChrisW and @CAccesible, both describe techniques which should do what you want. Just to add on what @ChrisW mentioned, a spatial join tool called Join by location would provide your points layer with another attribute column containing the names of the polygon it resides in, regardless of how many points there are in a polygon. ...


4

Use spTransform to transform the coordinates to WGS84: library("rgdal") library("rgeos") map <- readOGR(".", "kommuner1983") map_wgs84 <- spTransform(map, CRS("+proj=longlat +datum=WGS84")) plot(map_wgs84, axes=TRUE) gCentroid(map_wgs84) # SpatialPoints: # x y # 1 10.05 55.96 # Coordinate Reference System (CRS) arguments: +proj=longlat ...


4

The following script determines the bounding box of a raster and creates based on the bounding box a geometry. import ogr, gdal raster = gdal.Open('sample.tif') vector = ogr.Open('sample.shp') # Get raster geometry transform = raster.GetGeoTransform() pixelWidth = transform[1] pixelHeight = transform[5] cols = raster.RasterXSize rows = raster.RasterYSize ...


4

The forward sortation area (FSA) is only the first 3 characters in the six character Canadian postal code. You need to include the local delivery unit if you want unique values. From here:


4

As stated in GIS-Jonathan's answer this can be accomplished by setting the file permissions to Read-only. In windows 7 you can accomplish this by navigating to the file in windows explorer, right clicking the file with the .shp extension and clicking 'properties'. There should be two checkboxes near the bottom of the properties window that say 'Read-only' ...


4

You don't want to do that. What you want to do is add a second and third data frames on your map (on layout), one for Alaska, and one for Hawaii.


3

You can use the Geometry Export to CSV function on your shapefile to obtain coordinates via: MMQGIS > Import/Export > Geometry Export to CSV Make sure it is enabled in Plugins > Manage and Install Plugins...


3

Printing out the raw bytes isn't the problem. The issue is knowing where to look in the byte stream for the data you want. The dBase-III+ format used in shapefiles is documented in many places. It starts with a 32-byte header, then has one 32-byte field descriptor for each field, then a 1-byte terminator, then has N bytes for each record, the first of ...


3

Perhaps DIVA-GIS may contain the shapefiles you're after with some corresponding boundaries. Select India as your country and your subject, I chose Administrative areas and received 4 shapefiles of differing levels. Choose the "IND_adm3" layer to see all the Mumbai areas within the Maharashtra district. Note: The shapefiles are outdated as Mumbai is still ...


3

Working (albeit cumbersome) solution to convert KML-/KMZ-files with <gx:Track>-Extension to gpx/csv/tcx, via Googles MyTracks-App. I tried to import a .kmz-file to QGIS, containing a GPS-track as <gx:track>-Element. (Track was recorded with MyTracks-App on Android. I only had the .kmz.) After numerous attempts, using various tools ...


3

To find out the right CRS, create a new project in QGIS with project CRS set to EPSG:3857, load Google or OpenStreetMap background from the Openlayers plugin, and look where your data is placed. If you set the Layer CRS of your data to EPSG:32749 WGS 84 / UTM zone 49S, your data will be placed in the right position (at least the same place a Google search ...


2

This seems to work for me - I'm using the Admin Boundaries from Natural Earth and a Blue Marble jpeg (with a hand cranked world file) and this code which gives me this image. Without seeing your actual datafiles my suspicion is that you have a tiff file with either no world file or a broken one instead of a geotiff. If that is the case then you should be ...


2

Looks like you may not have GDAL installed, ogr2poly.py will not work without it. Download either the 32-bit or 64-bit GDAL installers, depending on your system. You need to install the GDAL core, and then the GDAL Python bindings.


2

I think this question is most easily answered by taking your shapefiles and doing two tests: Append them together and examine the result Union them together and examine the result If either or both tests cause an error or do not meet your requirements then, after reviewing their documentation, you will be in a position to ask a more focussed question. ...


2

If you mean to keep the attributes meaningful, it makes no sense to dissolve the overlapping polygons if you care about those attributes. Since it appears that dissolve has already occurred, then if your problem is sliver polygons, you should perform an Intersect on the one feature class and then select every polygon in the original that overlaps a small ...


2

If you don't mind a few extra geoprocessing steps, I would suggest a workaround. Before dissolving, perform the following steps. Select all features in your shapefile. This is easy to do with the 'switch selection' button in the shapefile's attribute table. Then perform a select by location, with the shapefile as both the input and the selection feature. For ...


2

This wont really be an answer, but its the only way I can add a picture. I have data from TeleAtlas/Esi. I cant talk to its accuracy, but I believe its data 2009 (and not sure how it was created). Downloading and overlaying the StatsCan data (which they say is used from CP with permission) you can see the obvious differences. TeleAtlas/Esri show T5E/T0A in ...


2

Actually, in order to be most useful you probably want to keep the tabular data as you have it with a separate record (or attribute) for each depth. Combining the data from each depth into a single field will limit the use or make it much more difficult. With it separate you can look at each depth as a different surface in interpolation or perform any other ...


2

There is a native (non-plugin) solution within QGIS: Right-click on your shapefile layer and select "Save as". Select CSV format; Deselect "Add saved file to map"; Under "layer options", select GEOMETRY AS_XY (for point files) or GEOMETRY AS_WKT (for points, polygons or lines). For point files only, this will output a CSV file with an X and Y column in ...


2

According to this ticket: http://josm.openstreetmap.de/ticket/10214 you need to have a .cpg file along with the shapefile with the correct encoding written inside. And a josm version that is less than 6 months old (when the bug was fixed).


2

I disagree that QGIS always uses multipoint. If you use the Extract Nodes tool, you get a single point layer, and converting Multipart to singlepart and back changes the geometry type as expected. You can run ogrinfo on the shapefiles to check the geometry type. Unfortunately, QGIS reports the layers metadata always as Point.


2

If qgis freezes, try the same command in GDAL/OGR: Open source software to merge large shape files It gives you the opportunity to see error messages, as well as saving valuable RAM that is used by the QGIS GUI. The shapefile 2GB limit that you cross can not be solved by that, so you need another output format, like spatialite database.


2

Those input points are not in urn:ogc:def:crs:OGC:1.3:CRS84, since that is (roughly) WGS84 lon / lat, and (taking the first point): [ 383707.21875, 9211513.0 ] is not a reasonable lon / lat combination. What QGIS is (probably) doing in converting that point to -52.78125,9211513.0 is taking 383707 and wrapping it around a few times (383707.2185 - 1066 * 360 ...


2

You can move your features using the Move Feature(s) tool on the Digitizing toolbar. Scaling is a little trickier, but can be done through the Affine tool in the Affine Transformations plug-in. See here for more on how to resize features in QGIS.


1

Use intersect tool with single input, call result OVERLAPS. Select original that intersect OVERLAPS and dissolve originals. Switch selection in originals and merge with dissolved.


1

I suggest to use this program to rename your files http://www.bulkrenameutility.co.uk/Main_Intro.php. It's open and easy to use. After you have renamed your file, you must open, with a text editor, your qgis project file (try notepad++) and make the same find&replace.


1

If you have a consistent schema for renaming them, you could do this in a python script. One method in python is os.rename(src, dest). Specific details would depend on what the algorithm for renaming the files is. This is for renaming the actual files, not just the layer names in the TOC. Otherwise, I don't know of an alternative to renaming them manually, ...


1

Is there more than one point in any given polygon? That relationship will affect available methods. A simple Intersect will get the polygon names on the points, regardless of the number of points in a polygon. To get the point attributes on the polygons will likely require a Spatial Join. If there is more than one point in a polygon, you have to decide ...



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