Editing a GeoJSON File

You can modify the properties and actions described in your GeoJSON files.

This task shows you how to:

Add Properties

You can add properties to your GeoJSON file to describe your points.

  1. Add the appropriate properties to your GeoJSON file:

    title
    Lets you specify a title.
    description
    Lets you describe the point.
    color
    Lets you define the html color to be applied to the marker.
    image
    Lets you define the marker symbol to be used.
    onclick
    Adds a custom action launched when clicking a marker.
    onmouseover
    Adds a custom action launched when the mouse pointer is moved onto a marker.
    html
    Displays a custom html content (in a popup) when clicking a marker.

    Below is an example:

    {
    "type": "FeatureCollection",
    "features": [
    { "type": "Feature", "properties": { "color": "#0000ff", "title": "Paris", "description": "France" }, "geometry": { "type": "Point", "coordinates": [ 2.492286, 48.844174 ] } }
    ,
    { "type": "Feature", "properties": { "color": "#ff0000", "title": "Madrid", "description": "description" }, "geometry": { "type": "Point", "coordinates": [ -3.688136, 40.312541 ] } }
    ,
    { "type": "Feature", "properties": { "color": "#ff0000", "title": "London", "description": "United Kingdom" }, "geometry": { "type": "Point", "coordinates": [ -0.324109, 51.554886 ] } }
    ,
    { "type": "Feature", "properties": { "color": "#ff0000", "title": "Lisboa", "description": "Portugal" }, "geometry": { "type": "Point", "coordinates": [ -9.281809, 38.768028 ] } }
    
    ]
    }

  2. Save the GeoJSON file.

Call Custom Actions

You can customize the available actions to adapt them to your needs.

  1. Describe the action to be customized and use a semi-colon to separate parameters.

    For instance:

    GlobeViewer.Marker.add;lat,lon,alt,color,title,description

    The available actions are listed below:

    GlobeViewer.Marker.add
    Adds a marker using the following format:
    lat,lon,alt,color,title,description
    GlobeViewer.Marker.clear
    Removes all markers.
    GlobeViewer.Country.add
    Colors a country using the following format:
    iso3-code,color,description
    GlobeViewer.Country.clear
    Removes all countries.
    GlobeViewer.Camera.move
    Modifies the camera viewpoint using the following format:
    lat,lon,level
    GlobeViewer.loadJSON
    Loads JSON data.

  2. Save the GeoJSON file.