MapBox - Search for markers from Javascript - javascript

I am working on a (private) school project.
I am new to javascript and ran into a problem.
On this page, you will find the project: http://www.curlydutchman.nl/fishinglocations/
What I want is to make a search box in where I can search for the markers that are on the map.
I followed this with success (but removed them again): https://www.mapbox.com/mapbox.js/example/v1.0.0/filtering/
but the problem is that these markers are loaded in from a CSV file. It seems that I cannot edit these pins, and add them to my 'search by filter' list... Also, if I would copy the coordinates of my pins in to the CSV file, they would show up on a different location of the map.
So I believe that my only solution is to link a search field to the markers that are located in my Javascript.
Has anyone got an idea on what the solution to my problem might be?

You approach of searching for markers on the map using setFilter for the GeoJSON looks correct.
if I would copy the coordinations of my pins in to the CSV file, they would show up on a different location of the map.
This may be a function of coordinates being reversed.
GeoJSON = longitude, latitude
CSV = latitude, longitude (depends on the field names)

Related

how to create a territories on a bing map using MVC4

I am new to the Bing maps. I am working on a territory map project.
I have a set of zip codes in my datatbase, I want the Zip codes to point on a map and also want to highlight that pointed region to form a territory.
I can point the zip codes but i am unable to draw a territory. Can any one help me on this, or can suggest me any links.

how to highlight markers on click in mapbox

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.

How to get KML or JSON data of (polygon) area using Google Map URL using JS or PHP

I would like get the KML or JSON data for the red polygon (as far as I know it's called polygon) area. I want to display the area in a custom map of my application and I will place some markers within this area.
You can check this example: https://goo.gl/maps/7SIeg
I just need to grab the KML or JSON object of the co-ordinates the red marked area.
I had same question.But, no there is no option that you can get KML of searched area and google maps will extract you a polygon.
But you can use various resources like
http://www.mapmash.in/kmlpolygon.html
http://geojson.io/
to create polygons yourself.
Regards,
Suyash

How to Save a Leaflet Map?

I have a webpage with a Leaflet Map, I can add markers,filter markers and so on. My question is that how can I save it?
1.Load the Map
2.Add some Markers on the Map
3.(Optional) Filter the Markers on the Map
4.Save the map together with the Markers that put on the map in a database(any possible storage)
5.Opening the map in the browser and view same as what i just saved.
Ive search everything but its too hard to do it any possible suggestions?, TYIA
Depends on backend you are using.
For Database you can use Postgresql with PostGIS. You create table with geometry or geography column and save marker latlng there. In other columns you saves additional data that define marker (id, description, whatever).
You can also save current marker layer as geojson file. And load it on opening map.
But you need to write some backend that takes in markers data or geojson and do something with it server side.
You can also take a look at Leaflet.Storage (and django-leaflet-storage as an backend)

Which one to use - Kml or Google Map Api

I want to show locations on google map based on the user search criteria i.e; if a user selects London, then all records from London should be displayed and if user enters his postcode then it should show the result within 25 miles of his postcode on the google map(All data will be coming from database php/mysql).
Now the question is What should I use? KML or google map api V3, As i want to give option to user to see brief info about the location, when he will mousehover that marker, and onClick of that marker I want to show the image of location and review count, and distance(calculated dynamically based on his postcode.), I also want to ceate custom markers. I have done some work on api V3 previously but wanted to know about KML. Does it supports my need? As according to my understanding KML is just a static file and can't give such dynamics.If so, can you please provide any sample and how to do that.
Thanks
Your understanding is correct, KML are just static files. You should be able to complete your requirements using combination of google maps api v3 methods like geocode, computeDistance etc.

Categories