Hot answers tagged shapefile
20
At a high level the way I choose is based on whether users are inexperienced and need nothing more than points, lines and polygons. Shapefiles are ideal for this.
If they need annotation, domains for pick lists and validation, raster, etc then use File Geodatabases which are easy to use, fast and can be massive in size.
I would never use Personal ...
6
I try to avoid using shapefiles as you cannot store domains, relationships, aliases etc. but they are the most portable format when distributing data to other people who are using different GIS systems/tools.
Whilst file geodatabases give better performance and are capable of storing huge datasets, everyone above is giving the humble personal geodatabase a ...
5
In ArcMap 10.1:
Clip the dataframe to the extent of the layer.
Dataframe Properties > Data Frame > Clip Options
You could also clip a new shapefile based on the county boundary. There are probably more ways, but these are the first that come to mind.
5
I would recommend clipping the raster to the shapefile, then in the resulting raster you can look at the number of cells present for each of your classes. The area can be calculated by multiplying the number of cells by the area covered each pixel (cell size squared).
It's a different approach than the equally valid solution offered above but from a ...
5
I generally use FGDBs, but it really depends on what you need to store. Like the other posts have mentioned, Personal GDBs are outdated and have size issues.
Using a geodatabase allows you to set up a topology, which you can't do with plain shapefiles.
Shapefiles hold the exact coordinates of the shapes. In a GDB, the locations are snapped to the nearest ...
4
The USDA Data Gateway has layers available for 1:12k quad footprints. Not sure if you can fetch the whole U.S. or not, but you can get them by state. Also, you can drag a custom AOI onto the map and get some pretty big chunks it looks like.
4
Most people would recommend storing your data in a database for performance reasons, i.e quick to query and search. However I believe there is also the benefit of currency when data is in a database. For example, if you pass a shapefile to a colleague they are likely to use that indefinitely but the data may have been updated. Where as if the data was stored ...
3
You can do this using Calculate Value and a bit of Python:
Expression:
make_fieldname(%Points%)
(where Points is the value you actually want to use, I just guessed)
Code Block:
def make_fieldname(input):
return '_'.join(input.split(' ')[1:])[:10]
This will take your input value, split it at the spaces, strip off the first element (the year in ...
3
You could also do this using a simple model in Model Builder.
Where the input file is your original file you want to split and the expressions are the definition queries selecting the records you are interested in exporting to a new shapefile.
3
You can use select by attribute to select the Field Values. then Export the selected features using @MappaGnosis answer.
Another Method: using Definition Query in layer properties. you can query based on values and export each query.
There is a tool named Split Layer by Attributes that you can use to split the layer by select a field .
3
This can be accomplished using three main steps:
Convert your raster to polygons using the Raster To Polygon tool
Overlay your polygons (from raster) with your shapefile using the Intersect tool or Union tool - which depends on how many polygons you want output
Tabulate your results using the Summary Statistics tool (or perhaps the Tabulate Intersections ...
2
if you want full-blown geodatabase capability (Coded Value Domains, Relationship Classes, Topologies, Geometric Networks, etc blah blah, without the complexity or admin overhead of relational geodatabase, AND/OR you want the fastest drawing, cursor, and geoprocessing performance, File Geodatabase is the way to go. Local disc access is much faster than a ...
2
I'm not sure solutions to this problem have anything to do with deleting files, so pyshp probably works fine. Here's how to split a Natural Earth shapefile feature-by-feature with Fiona:
import os
import fiona
dest = "/tmp/countries/"
infile = (
"/Users/seang/data/ne_50m_admin_0_countries/"
"ne_50m_admin_0_countries.shp")
with fiona.open(infile) ...
2
In your script, you are creating a temporary layer without saving anything permanent. Use Copy Features (Data Management) to make your layer permanent:
arcpy.CopyFeatures_management (lyrOutFile, out_fc)
2
There are a lot of options. OpenLayers or Leaflet are probably a good place to start for the client side and they can read local shapefiles. For more options have a look at the OsGeo website (especially note the webmapping links on the right hand side).
2
Try just setting project CRS and enabling on-the-fly reprojection. Don't touch the layer properties. If the Shapefile .prj definitions are read correctly by QGIS, that's all you need to do.
Similar questions:
Why don't my Shapefiles and OSM data overlap in Quantum GIS?
QGIS layers no longer overlay when Enable 'on the fly' CRS transformation ...
2
To summarize the very useful comments by @Spacedman, @JeffreyEvans and @AriB.Friedman, but also to address the questioner's second problem about saving the generated subset and to provide a reproducible example for future audience, let me add a brief example to cover the whole topic. In fact, I'm much more often working with raster data than point or polygon ...
2
Try using Split (Analysis) to subset your data.
To illustrate, I added a new text field to the split features (i.e. 1-16 based on OID) and used that as the basis for the split. There are 16 resulting shapefiles on the image to the right.
Also, try the Split Layer by Attributes script tool if you have licensing issues. I believe you may need to ...
2
Not the operating system you want, but BaseCamp by Garmin can read your kml file, and exporting to csv gives a file that can be added with delimited text to QGIS. The data leads to Indonesia.
EDIT
Unfortunately, KML is not a very strict standard. That means that almost every form of data storage is allowed, as long as it is valid XML. The kml drivers ...
1
I'm going to suggest two things you may be looking for:
Feature Compare will "report differences with geometry, tabular values, spatial reference, and field definition"
Union "Computes a geometric union of the input features. All features and their attributes will be written to the output feature class." - this will enable you to compare the value of any ...
1
In the while loop, no doesn't refer to anything, you need to assign it to the current feature. I don't know how the QGIS API works, so here's a somewhat ugly approach:
while True:
try:
no = nodedata.nextFeature(nos)
except:
break
print str(no.gid())
1
Couple of suggestions: run a check geometry tool on your layer that you wish to clip, you could then follow that up with a repair geometry if it finds errors. You may wish to do that on a backed up copy.
Are the corrdinate systems different? Are you trying to clip a dataset in decimal degrees with a dataset that is in meters or vice versa? If so reproject ...
1
You cannot add data from a shapefile directly to the MapView. You can only add various types of Layers to the Map View. See this Page for more details: Map layer types
You could however create a Map Tile Package from a mapservice and use it instead if you desire offline access, by using it in a Local Tile Layer
1
Opening the dxf with Add Vector layer and labelling with text datafield gives almost the same as Autodesk Design Review:
The DXF file contains points and polygons in the same layer. This is not allowed in shapefiles. That is why you can not save it as a shapefile.
Exporting as kml will work, as this format supports different geometry types.
You have to ...
1
Hey If it is a case that you want to load it into Qgis and display the lables just do it that way there is no need to put as shapefile.
Sorry on further reflection and looking at the data. Why not load as dxf and split vector layer. load them in as shapes then.
I seem to get most text come through.
Or perhaps split the layers in autocad and save as ...
1
After making your event layer use the feature class to feature class method, see example below:
# Process: Make XY Event Layer
arcpy.MakeXYEventLayer_management(InputCSV, "lng", "lat", Book1_Layer, "", "")
# Process: Feature Class to Feature Class
arcpy.FeatureClassToFeatureClass_conversion(Book1_Layer, outputDir, fcName)
For geoprocessing tasks you can ...
1
I'd recommend having a look at the OSGeo site. They have loads of information about open source GIS from all parts of the spectrum. Look at the right hand side of the home page and you'll see 'Web Mapping' which lists a bunch of Open Source applications you can use for web mapping.
At my organization we personally use (which many others also use) GeoServer ...
1
I just tested this and it worked!
The layer file that I added, and then changed the data source of, was saved from a layer called dummy that pointed at a dummy.shp file.
import arcpy
mxd = arcpy.mapping.MapDocument("C:\\MAPS\\map.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
addLayer = arcpy.mapping.Layer("C:\\SYMBOLOGY\\symbology.lyr")
...
1
I haven't tested this out, but the easiest way should be to simply rename (or copy) symbology.lyr to points.lyr (the same basename as your shapefile). Generally speaking, when you load a shapefile into ArcMap that has a similarly name Layer file, the symbology of the layer "follows" the raw data (shapefile) and is applied on load.
1
After finding this comment, I searched for this spatial_ref_sys table and inserted it into to my PostGIS database.
Reloaded the shapefiles into PostGIS in ESPG: 900913.
Restarted TileMill, added my PostGIS layers, and they are all layered correctly.
Only top voted, non community-wiki answers of a minimum length are eligible





