A shapefile is an Esri vector data storage format for storing the location, shape, and attributes of geographic features. It is stored as a set of related files and contains one feature class. Shapefiles often contain large features with a lot of associated data and historically have been used in GIS desktop applications such as ArcMap. If you have a small amount of data in a shapefile, you can make it available for others to view through a web browser by adding it as a .zip file containing the .shp, .shx, .dbf, and .prj files to a map you create with Map Viewer.
When you add a shapefile, Map Viewer converts it to a format that web clients can quickly read and display. To help further improve the performance of the display, you can choose to generalize the features in your shapefile. Generalizing reduces the size of the shapefile by simplifying the features and is often appropriate for data at small scales.
Generalize features for web display
Shapefiles often contain large features with a lot of associated data. Smaller features with less data are often necessary for the shapefile to display properly over the web. Generalizing the features is one way to reduce the size of the shapefile and therefore improve web display. You can generalize the features using a desktop application such as ArcMap, or you can have Map Viewer do the generalization when you add the file to your map. Generalizing reduces the precision of the shapefile layer to approximately 1 meter in Web Mercator and will remove vertices within 10 meters in Web Mercator. This should maintain an informative and accurate display of your features while reducing the overall size of your data and allowing your layer to quickly display in the map.
Generalizing doesn't work well on coincident polygon features intended for large-scale display because it will create some slivers in the polygons. For coincident polygons at large scales, you can choose to maintain the features if you have a relatively small amount of data, or if you have a large amount of data, you can publish a feature service to a GIS Server site. If you have publishing privileges in your organization, you can also create feature layers by publishing features.
Considerations for adding shapefiles
Shapefiles were originally created to perform geoprocessing on desktop apps. They are now supported in a number of web browser clients including Map Viewer. There are some limits to what web browser clients can support.
Below are best practices for using shapefiles in Map Viewer.
- Choose to generalize features for web display if you have a large amount of features intended to be displayed at small scales and you have not already generalized your vertices in ArcGIS Desktop.
- Create a .zip file that contains the .shp, .shx, .dbf, and .prj files that comprise the shapefile.
- Store your shapefile directly in the root (the central directory) of the .zip archive and not in directories within the archive. If your .zip file viewer shows path information, the path should be blank.
- The name of the new layer is the same as the name of the .zip file you added. You can rename the file before adding to the map, or rename the layer once it is part of the map.
- Add standard compressed archive .zip files.
- Shapefiles that have more than 4,000 point features (or 2,000 line or polygon features) or are larger than 10 MB cannot be added directly to Map Viewer. If the file is too large, generalizing the features will often reduce the overall size and allow the shapefile to be added to the map. If that doesn't work and you have publishing privileges in your organization, you can publish your shapefile as a hosted feature layer.
- The shapefile should contain valid geometries. If you have ArcMap, you can use the Repair Geometry geoprocessing tool to correct invalid geometries in shapefiles.
- Include in the shapefile the accompanying .prj file in which the coordinate system of the data is defined. If you have ArcMap, you can define the coordinate system of a shapefile, which creates an appropriate .prj file for the shapefile.
The following limitations apply to using shapefiles in Map Viewer:
- Compression formats other than a .zip archive are not supported.
- The shapefile must be less than 10 MB in size and have less than 4,000 point features or 2,000 line or polygon features. If you have publishing privileges in your organization, it is recommended that you publish shapefiles that exceed these limits as a hosted feature layer.
- The following features are not supported: multipatch or multipoint geometries, geometries that cross the dateline, or self-intersections in polygons. Shapefiles with these features cannot be added to a map.
- Shapefiles cannot be dragged directly onto Map Viewer; you must use the Add button in Map Viewer.