Jump to content

 
Photo

CartoDB or Mapbox - search for marker

- - - - -

  • Please log in to reply
3 replies to this topic

#1
ErinGreb

ErinGreb

    Contributor

  • Validated Member
  • PipPip
  • 33 posts
  • Gender:Female
  • Location:Doylestown, PA
  • Interests:atlas design, textbook cartography, historical map design, guidebook maps
  • United States

I know how to make a simple web map with markers and attribute data (let's say a name of a person at a location). What I don't know is how to add a search bar where the user can type the name and the map highlights that marker. Does a tutorial exist for this (Mapbox or CartDB, either one is fine), or can someone point me in the right direction? Super newbie with web-mapping - I've taught myself a lot, but google is failing me on this one. Thanks!



#2
David Medeiros

David Medeiros

    Hall of Fame

  • Moderator
  • PipPipPipPipPipPipPip
  • 1,312 posts
  • Gender:Male
  • Location:Redwood City CA
  • Interests:Cartography, wood working, wooden boats, fishing, camping, overland travel, exploring.
  • United States

I don't know of a tutorial, but I do know that CartoDB has a search box element that you can add to a map. When searched it will zoom to the feature if found, place a pin, and open a pop up with the feature name.

 

There may be other functionality when you publish to a public map.

 

- d


GIS Reference and Instruction Specialist, Stanford Geospatial Center.

www.mapbliss.com
@mapbliss

#3
ErinGreb

ErinGreb

    Contributor

  • Validated Member
  • PipPip
  • 33 posts
  • Gender:Female
  • Location:Doylestown, PA
  • Interests:atlas design, textbook cartography, historical map design, guidebook maps
  • United States

I don't know of a tutorial, but I do know that CartoDB has a search box element that you can add to a map. When searched it will zoom to the feature if found, place a pin, and open a pop up with the feature name.

 

There may be other functionality when you publish to a public map.

 

- d

Thanks for the response. Yes, the capability is there to add a search box that finds a location, like a town. But it doesn't search for your imported data markers. I know I'll have to do some coding, which I don't have much experience with, but if there is a sample or tutorial I could figure it out.



#4
tangnar

tangnar

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 143 posts
  • Gender:Male
  • Location:South Carolina
  • Interests:Rivers, Urban Design, Geomorphology, Bicycling, Outdoors
  • United States

I have done this using Leaflet, with this Leaflet-search plugin. Mapbox is built on leaflet, so there should be some ability to integrate, but I'm not exactly sure off hand. You could also go straight Leaflet, but still use your Mapbox basemap. Mapbox shows you how in it's docs, it's under something like "Plain Leaflet". This 'search' plugin already has the functionality built in that highlights and zooms to marker when it is found via the search. You can see it being used here http://scgeology.github.io/wellInteractive/ 

 

I also found some different things on Mapbox.js documentation, under 'filtering'.  This may help, but you'd have to figure out the zoom/highlight part. 

 

I'm not too familiar with CartoDB, but since it is a database, there should be a way to query the table. 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->