Load spatial data (simple)
This sample shows how to easily load spatial data using the spatial io module into the map. The
atlas.io.read
function supports reading KML, KMZ, GPX, GeoRSS, GML, GeoJSON, CSV (with spatial columns). This function can take in a string that contains the raw data or a URL to the data. The data format will be automatically detected and parsed acoordingly. This function returns a SpatialDataSet object that extends from a GeoJSON Feature Collection. Passing this directly into a data source will load all features in the data set. Here is a list of all the properties within a SpatialDataSet object.
bbox - Bounding box of all the data in the data set.
features - GeoJSON features within the data set.
groundOverlays - An array of image or OGC map layers that represent KML GroundOverlays.
properties - Property information provided at the document level of a spatial data set.
stats - Statistics about the content and processing time of a spatial data set.
icons - A set of icon URL's. Key = icon name, Value = URL.
type - The GeoJSON type; "FeatureCollection".
Note:
Not all file and mime types are enabled in all servers. If using .NET, it is recommended to add the following to the web.config file in the <system.webServer> section:
<staticContent>
<remove fileExtension=".json"/>
<mimeMap fileExtension=".json" mimeType="application/json"/>
<mimeMap fileExtension=".geojson" mimeType="application/json"/>
<mimeMap fileExtension=".gpx" mimeType="application/xml"/>
<mimeMap fileExtension=".georss" mimeType="application/xml"/>
<mimeMap fileExtension=".kml" mimeType="application/vnd.google-earth.kml+xml"/>
<mimeMap fileExtension=".kmz" mimeType="application/vnd.google-earth.kmz"/>
<mimeMap fileExtension=".tab" mimeType="text/plain"/>
<mimeMap fileExtension=".pipe" mimeType="text/plain"/>
</staticContent>