how to highlight markers on click in mapbox - javascript

I'm doing a mapbox project, where I have a list of projects on the right side of the screen. Each time I click on the list of a project name, the map will zoom to the location of the project.
I imported the markers to mapbox and used mapID to show them on the map.
Now I want to highlight the marker for each project that I click on. The mapbox highlight examples are based on geojson or csv, but I imported the markers from mapbox editor. Can anyone show me how to do the highlight?

The code will be generally the same: see the L.mapbox.featureLayer documentation: instead of using setGeoJSON or loadURL like the examples do, initialize it like L.mapbox.featureLayer('mapid'), replacing 'mapid' with your mapid.

Related

adding popup on features in leaflet geojson-vt

I have a map where i used the leafet-geojson-vt plugin (https://github.com/brandonxiang/leaflet-geojson-vt/tree/leaflet1.0.0) to draw GEOJSON data in a canvas layer with geojson-vt.
I'm able to add the layer to the map, however, I don't know how to add popups on click for each polygon/tile/feature in the layer. I've tried searching for examples but cannot find ones using the geojson-vt plugin.
How can I add such functionality using the example in the link above?
Any help is appreciated.

ngx-mapbox-gl Mapbox GL Popup with Feature layers and not with Markers

I am creating a Mapbox GL page using ngx-mapbox-gl. I am using GeoJson Feature layers to create clusters and individual points. My code is based from this example
https://wykks.github.io/ngx-mapbox-gl/demo/cluster
This is using Features and not Markers to display points.
I would now like to further extend that example to allow popups for individual points. I don't know exactly how to do that. The examples show adding a popup directly attached to a Marker.
Interestingly enough, the exact functionality I am looking for is located by viewing a geo json file directly from GitHub.
https://github.com/Wykks/ngx-mapbox-gl/blob/master/projects/showcase/src/app/demo/examples/earthquakes.geo.json
Popups are displayed for individual points. I'm assuming those points are in the form of a Feature layer? Does anybody know where I can get the source for that viewer or help me with adding popups to Feature layer in ngx-mapbox-gl?
Thanks, Mike

Change Leaflet Map Zoom control style using Drupal Leaflet module

I am unable to find settings where I can make Zoom Control Style "Large" for Leaflet map.
Current system
My Page is coming from View, where view format is "Map (Leaflet API, via IPGV&M)". I am displaying custom markup on map using Leaflet marker.
I am using following modules for D7
Leaflet
Leaflet views
Leaflet More Maps
ip_geoloc
Edited
I need to change Zoom control style from Small to Large. This is a small Zoom control: prntscr.com/9eeq41 and This is a Large prntscr.com/9eeqqu
You can achieve this by including Zoomslider JS and CSS in your theme's js and css folder respectively.
Bind it with leaflet.map and then add zoomslider control to map.
Your code should look something like this :
jQuery(document).bind('leaflet.map', function(event, map, lMap) {
L.control.zoomslider().addTo(lMap);
});
This will add zoomslider control to your map.
You can find Reference here : Leaflet Zoomslider
Go to admin/structure/types/manage/YOUR_CONTENT_TYPE/display.
At Geofield (field) format choose leaflet and click the settings
icon on the right.
There you can change min/max view settings like in the pic.

Google Maps - Drag & drop markers and draw routes

I am trying to implement an interface like below with jQuery/JS and Laravel PHP framework. Could anyone help me to figure out the following questions I have?
How to make the markers draggable and on marker release get the
lat/lon?
How can I show the real path between point 1 & 2 (like the blue line. when I change the marker a new line will be drawn based on the shortest distance)?
If there are multiple markers connecting to each others like below, how can I get the optimise route?
For markers are connecting to each others.
This is the optimise route to visit all 4 markers (shortest path to visit)
Is there an open source project similar to this? (like jQuery calendar)
If you know any resources/plugins related to achieving something like this please comment below.
Draggable markers on Google Map - search for "Make a marker draggable":
https://developers.google.com/maps/documentation/javascript/markers
Planning route from point A to point B based on road map. You can use Directions API:
https://developers.google.com/maps/documentation/directions/intro

Dynamically create markers in OpenLayers 3

I'm developing an application that loads lots of markers in OpenLayers 3.
However, I would like to dynamically display and load markers while user is panning at a certain zoom level.
Could someone provide me an example, or directions to do that?
For instance, I would like to first create an example that drops a marker where user has clicked on the map.
So, with this information, I will be able to handle the rest and post my solution here.
I've managed to create a way for setting this up:
http://weebah.com/weebah_examples/click_to_create.html

Categories