Leaflet GeoJSON Search Example with Points

2,180 views
Skip to first unread message

Claudio Herger

unread,
Jul 18, 2013, 9:52:44 AM7/18/13
to leafl...@googlegroups.com
Hey,

I'm a newbie with Leaflet. I'm trying to convert the Example from Bryan McBridge so that it works with GeoJSON Points. But it will not work. Can anybody help me?

Thanks 

Michelinho

unread,
Jul 18, 2013, 12:37:57 PM7/18/13
to leafl...@googlegroups.com
You have to save the geojson file as a POImin.js and load this file into your html <script src="../mydata/POImin.js" type="text/javascript"></script> - did you?

Claudio Herger

unread,
Jul 19, 2013, 4:14:51 AM7/19/13
to leafl...@googlegroups.com
Yes I take my File on this way. I'v changed the name from .json to js, but I think it's not my main problem. Is it poosible that my Point GeoJSON not have the same BBox Extend as a Polygon GeoJSON?

My first try looks this way: 

Bryan McBride

unread,
Jul 19, 2013, 1:09:16 PM7/19/13
to leafl...@googlegroups.com
See attached file for point modifications.

BRYAN
geojson_hacks.html

Claudio Herger

unread,
Jul 22, 2013, 3:29:47 AM7/22/13
to leafl...@googlegroups.com
A great thank you for the help!
It works and it's beautiful.

Great :)

Jennifer Lishman

unread,
Aug 8, 2013, 9:17:27 PM8/8/13
to leafl...@googlegroups.com
Agreed, this is great! This will save me a lot of time and effort.  I was hoping to develop a solution for points that is a hybrid of your work and and the leaflet-search plugin http://labs.easyblog.it/maps/leaflet-search/.  

Stefano Cudini

unread,
Dec 5, 2013, 11:47:41 AM12/5/13
to leafl...@googlegroups.com
after a recent update .. L.Control.Search now supports the search for points within GeoJSON layer.

Arnie Shore

unread,
Dec 5, 2013, 11:52:23 AM12/5/13
to leafl...@googlegroups.com
Wonderfulnessity! In English, Excellent! AS

On 12/5/13, Stefano Cudini <stefano...@gmail.com> wrote:
> after a recent update ..
> L.Control.Search<http://labs.easyblog.it/maps/leaflet-search/> now
> supports the search for points within GeoJSON layer. ... <snip />

Evan Chakroff

unread,
May 9, 2014, 3:51:40 AM5/9/14
to leafl...@googlegroups.com
Thanks for posting this, it has really helped a lot as I get started on a mapping project... I think I understand what you've done here, and tried to extend it a bit, but I wonder if you could help explain something.

I've changed the code to read from a geojson file with no variable defined in the file, and added a bit of code to take a variable from the URL and pop up and zoom to the associated marker. The problem is, my ID numbers for the geojson layer are off from the id numbers for the leaflet layer. I'm just getting started with this, so forgive me if i don't have all the terminology down - hopefully you can see what i mean from the attached files. Essentially, what I'd like to do is be able to open the page with 'index/html?id=4" and have it popup and zoom to item 4 from the geojson file.

Thanks in advance, if anyone has any ideas.
E
json-map_2.htm
macau.geojson
Reply all
Reply to author
Forward
0 new messages