Jump to content
TNG Community
XerxX

Replacing Google Maps with OSM

Recommended Posts

XerxX

This thread is a continuation of the thread "Google Map API Change"

and is only about using Open Street Maps instead of Google Maps if you don't have a Google Map API key.

(Or if you have exceeded your limit and Google doesn't show the maps ;) )

Ultimately this will become a mod to be used in these cases.

 

So the current stage of the development is this (and is working at my site - starting links below):

* I have installed the latest Open Layer JavaScript and .css files at the server (speeding things up a bit)

* I have made a new "osmmaplib.php" to be used instead of "googlemaplibOSM.php" that I used before

* getpersonOSM.php works.

- - - The map boundaries may not be the best as I haven't fine-tuned the different levels yet

- - - Person-links open a "OSM-getperson" page (you don't have to insert anything in the URL)

- - - Magnifying glasses in "Person-places" (not to the right of the map) open a "OSM-placesearch" page

* placesearchOSM.php works

- - - Person-links open a "OSM-getperson" page

- - - Swedsih places have zoom = 10, European = 7 (mostly) and USA = 5 (mostly)

 

To do:

* Modify the cemeteries page like the placesearch.php

* Make the Admin pages show OSM and accept point-and-click coordinates

- - - There is an example of retreiving coordinates (Lat & Long) in the docs 😄

* Fine-tune the zoom levels for getperson maps

 

The modifications are collected in a mod that I install in my TNG v12 test environment (w/o API key), thereby making sure it will work.

(I want to keep the OSM pages separate from my live site...)

The mod will probably work also w/ an API key as I simply (so far anyway) could just remove the "$map['key'] conditions".

 

A link for a person: https://xerxx.se/getpersonOSM.php?personID=I158&tree=tredNr2

A link for a place: https://xerxx.se/placesearchOSM.php?psearch=Almby%2C+Örebro+län&tree=tredNr2

You can select English or German by the flags up left.

Questions? Ask them here...

 

Regards,

Erik

Share this post


Link to post
Share on other sites
Newfloridian

Will this mod ultimately be compatible with previous versions of TNG? I've had Googlemaps running without API or map key but with  $siteKey; and &secret; variables (presumably from Google) placed in  customconfig.php since the earliest days (?TNG 5) - now at TNG10.1.3

Alan

 

 

 

Share this post


Link to post
Share on other sites
XerxX

Hi Alan,

I do _hope_ so and today I can't see why not. But it's primarily made for TNG v11 and v12.

v11 because that's my live site today (using a key = "1" ;) ) and v12 for the future.

/Erik

Share this post


Link to post
Share on other sites
Chris Lloyd

Looks like a good fix Eric - thanks.

Share this post


Link to post
Share on other sites
XerxX

Thanks Chris! Encouragement is always welcome :)

 

Now both headstonesOSM.php and showmapOSM.php works.

You can start here:

https://xerxx.se/getpersonOSM.php?personID=I2&tree=tredNr2

Click the magnifying glass for her burialplace and there you can select the cemetery.

 

 

There is also a heat map in TNG - I forgot about that.

I saw some kind of heatmap among the examples in the OSM docs. I will try to make something out of it.

/Erik

Share this post


Link to post
Share on other sites
Ken Roy

Looking good Erik,

Will the Person Map (or Mobile Individual Page Map - Person Map) mods also work?

What about the Google Maps - More Place Levels and Google Maps 15 mods?

and the Geocode Assist Mod?

I imagine those mods will require an OSM version.

 
 
 

Share this post


Link to post
Share on other sites
XerxX

Thanks Ken,

Actually; I run Mobile Ind Page Map and Gmaps add 4 placelevels w/o any modifications. Look at the legend.

EDIT: I _have_ modified the mods a bit but that was previous and not for this purpose.

In the getpersonOSM.php script the only changes are that the $map['key'] part of conditions are removed.

The map is then put there by the osmmaplib.php (equivalent to googlemaplib.php) so there is no need for new versions.:)

 

And I just now had confirmation from my bank that they don't have pre-paid cards w/o connection to my account.

I have to apply for a separate account which, including a card, will cost me like $3.50/month!

Stupidity!

/Erik

Share this post


Link to post
Share on other sites
Ken Roy

Thanks Erik,

i will have to double check.  i thought some of those mods did make some modifications to googlemaplib.php. 

Others like me will certainly appreciate the work you are doing on developing an alternative, since i certainly will not provide a credit card, not even a prepaid card.

If there is anything I can do to help, let me know.  I would be interested in what kind of modifications you made to the mods, so contact me off list and off forum.

Share this post


Link to post
Share on other sites
XerxX

Hi All,

I had this question in a mail and I thought I should reply also here as more may wonder the same thing:

NO! There will NOT be two separate pages (f.ex. both a getperson.php and a getpersonOSM.php) - that is _only_ at my live site while testing.

I want to keep my ordinary pages (w/ Google maps) intact while testing, and displaying the OSMs for you.

Visitors that don't know about it don't see the OSMs.

/Erik

(Ken: You have mail)

Share this post


Link to post
Share on other sites
pleijtng

Top Erik,

I look forward to the Mod, I use version 12.
As long as we are rid of Google's conditions.

Hans

Share this post


Link to post
Share on other sites
XerxX

Hi all,

I use the mod Mobile Ind Page Person Map and I have discovered something that happens when it is installed:

If you collapse and then expand the map it is doubled! This is not good.

https://xerxx.se/getpersonOSM.php?personID=I2&tree=tredNr2

It doesn't happen w/o the mod (it seems...) nor with the mod and Googlemaps.

Anyone got any idea why? Please...

 

I'm right now trying to make the admin_editplace.php work because I think that w/o the point-&-click interface this mod will be almost useless.

(Either we will have to enter the coordinates by hand (copy-&-paste from somewhere - where?) or the mod can only display maps already in the database.)

/Erik

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×