Hexagon Geospatial
MENU

Smart M.App

Looking for answers in regards to M.Apps, M.App Exchange or M.App Studio? Smart M.App Tech Discussion board is where you can search, ask your questions and assist others by sharing your knowledge. Join the conversation, connect, contribute and share.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Technical Evangelist
Posts: 1,033
Registered: ‎09-11-2015

How to attach custom event handler to GeoJSON elements?

I'm looking for a way of adding custom event handler for the GeoJSON elements? The default handler in BI Map just communicates with the charts but I'd be interested also to different behavior (such as opening URL based on some attribute).

 

Basically it should be possible to do that through Leaftlet JS but I don't know the correct approach and how to find GeoJSON object in DOM.

http://gis.stackexchange.com/questions/121482/click-events-with-leaflet-and-geojson

 

Thanks

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Technical Evangelist
Posts: 1,033
Registered: ‎09-11-2015

Re: How to attach custom event handler to GeoJSON elements?

[ Edited ]

Well after the new release of SMApps there might be a way of doing this:

  • get the choropleth object, something like:
      // need to know leafletMapId
      var layerGroup = L.layerGroup();
      chart = gvc.chart.choropleth(leafletMapId, leafletLayerGroup);
  • override it's events using layer.on(...) function

 

Sounds simple but requires some more investigation Robot wink

 

Leaflet tutorial:

http://leafletjs.com/examples/choropleth.html

 

Our GVC logic documentation:

http://community.hexagongeospatial.com/t5/API/GVC-Javascript-Library/ta-p/3709

 

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.