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.
The following list summarizes how you can use shapefiles in ArcGIS Online and provides links to instructions:
- Add shapefiles (in a .zip file) to My Content to share with others.
- Publish a hosted feature layer from a shapefile (.zip).
- For hosted feature layers that have export enabled, you can export the layer data to a shapefile.
- Add a shapefile (.zip) as a layer to Map Viewer.
When you add a shapefile to Map Viewer, Map Viewer converts the shapefile to a format that web clients can quickly read and display. To 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 perform 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 removes 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 creates 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. 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
The two sections below offer best practices and provide information on limitations when working with shapefiles in ArcGIS Online.
The following are best practices for using shapefiles in ArcGIS Online:
- 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.
- When you 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, 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 it to the map, or rename the layer once it's part of the map.
- Add standard compressed archive (.zip) files.
- The shapefile should contain valid geometries. If you have ArcGIS Pro or ArcMap, you can use the Repair Geometry geoprocessing tool to correct invalid geometries in shapefiles. Invalid geometries cannot be drawn in Map Viewer.
- 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. If you have ArcGIS Pro, you can define the coordinate system of a shapefile using the Define Projection geoprocessing tool.
The following are known limitations when working with shapefiles in ArcGIS Online:
- 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 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, 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, and self-intersections in polygons. Shapefiles with these features cannot be added to a map.
- You cannot drag shapefiles directly onto Map Viewer; you must use the Add button in Map Viewer.