GeoJSON | Documentation

It's now possible to use GeoJSON to generate the shapes of states and locations (v4.4+). This makes it possible to create overlays that can be positioned using the level property.

State/Location GeoJSON properties
geojson_url The url of the GeoJSON file.
(e.g. https://hosting.simplemaps.com/examples/states.json).
geojson_field The fieldname used for selecting features (e.g. STUSPS).
geojson_value The value of geojon_field for the targeted feature (e.g. NY).

Defaults can be set for the above in the main_settings (e.g. main_settings.state_geojson_url).


Examples

Here is a simple example that will create a state with the shape of Ohio and lay it over the US map:

state_specific: {
    OH_overlay: {
      name: "Ohio Overlay",
      geojson_url: "https://hosting.simplemaps.com/examples/states.json",
      geojson_field: "STUSPS",      
      geojson_value: 'OH',
      color: 'red',
      hover_color: 'darkred',
      opacity: .3, //allows us to see through the state
      level: 4 //place this state above exising states (level 3)
    },   
}    

You can copy the above and paste it into the "Code" section of your map to test it out.


Advanced State/Location GeoJSON properties
type Optional. Giving a state a type of 'geojson' will make it use its id as the geojson_value. Giving a location a type of 'geojson' will import the geojson features in order (if geojson_value is not set).
feature Optional. Allows you to reference the GeoJSON object's feature explicitly (e.g. geojson['features'][0]). Most useful for dynamic applications.

Home | License | Privacy | Releases | Testimonials | Resources | Documentation | Order Lookup | All Maps | FAQs
Formerly FlashUSAmap.com and FlashWorldMap.com
SimpleMaps.com is a product of Pareto Software, LLC. © 2010-2024.