Jump to content
TNG Community

Map showing all locations of events


Born

Recommended Posts

  • 1 month later...
  • Replies 69
  • Created
  • Last Reply

Top Posters In This Topic

  • Steven

    13

  • Born

    8

  • Ken Roy

    6

  • thewillistree

    5

Top Posters In This Topic

Posted Images

I've had a go at creating a map showing all geo-coded locations in the tree. Clicking the pins on the map takes you back to the placesearch.php page.

A few warnings;

This has only been tested on TNG 6.2 with template 4

I've only tested with less than 100 locations

I'm new to PHP & Javascript so this probably isn't the most robust or secure code

but it seems to work OK on my website

Hope you find it useful

world_map.zip

Link to comment
Share on other sites

Hello Roger,

thank you for writing this piece of Code. Unfortunately it does not work at my page. I edited the three lines and uploaded the file to my root. It always stops at the line with ShowTheMap(); and the end of the script. So I tried to include the googlemaplib-files and also tried to store the file in the googlemap-folder but always the same error. Then I reduces the amount of locations in the select statement by selecting only locations beginning with "a" but still the same error. Could you have a look to it? Please check: www.ziegenfuss-genealogy.de/world_map.php

Thank's a lot in advance,

Marco Born

Link to comment
Share on other sites

Hello Roger,

thank you for writing this piece of Code. Unfortunately it does not work at my page. I edited the three lines and uploaded the file to my root. It always stops at the line with ShowTheMap(); and the end of the script. So I tried to include the googlemaplib-files and also tried to store the file in the googlemap-folder but always the same error. Then I reduces the amount of locations in the select statement by selecting only locations beginning with "a" but still the same error. Could you have a look to it? Please check: www.ziegenfuss-genealogy.de/world_map.php

Thank's a lot in advance,

Marco Born

I didn't change one thing and it ran on my site... BUT... with 2362 places it took at least 5 minutes to finish....

And the US was one big red blob.

I'm still running 6.1.3 as I was never enamored with 6.2.0. I did not try it with 7.0.0 as I never run a first major code software as there are always "undocumented features".

Interesting code but not something I would want to have on my site as a user selectable item.

Scotty

Link to comment
Share on other sites

Hello Roger,

thank you for writing this piece of Code. Unfortunately it does not work at my page. I edited the three lines and uploaded the file to my root. It always stops at the line with ShowTheMap(); and the end of the script. So I tried to include the googlemaplib-files and also tried to store the file in the googlemap-folder but always the same error. Then I reduces the amount of locations in the select statement by selecting only locations beginning with "a" but still the same error. Could you have a look to it? Please check: www.ziegenfuss-genealogy.de/world_map.php

Thank's a lot in advance,

Marco Born

Please note I didn't write this - it was written by Steven.

I was involved in the Googlemaps Add on that was integrated into TNG 6.2.0, but shied away from requests for something like this for the reasons Scotty mentions in a post here - too many places and it would be an unbelievable CPU hog!!! My large Clan Moffat Society file has over 11,000 places in it - not that they're geocoded, but if they ever were, it would probably blow up both my server and whatever browser tried to load it.

But that said, the author says it works on his site as-is, and for it to work for me on TNG 7 I had to remove the line I mentioned above.

One possible reason for a failure for some people might be that the name of the places table is hard coded into that script as `tng_places`, and so if for whatever reasons your TNG tables aren't called that, you need to change it - or better yet perhaps use the variable $places_table (without the ` ` around it) which will always work no matter what the tables are named.

But in Born's case the data is retrieved and shows in the source code of the page, but the map doesn't get drawn from that data.

In your source code what is this line

<script language='Javaacriptt' type='text/javaacript' src='http://dhost.info/dh_468x60.php'></script> 

about - it's a bad spelling of Javascript for one thing.

Roger

Link to comment
Share on other sites

Hello,

I did wonder what would happen with loads of geo-coded places, as I said only about 100 of my 1,000 odd places thus far have geo-codes. One way to perhaps speed things up would be to remove the sidebar but this wont overcome the 'red blob' effect. However I appreciate with 1000's of places its probably better off trying to deal with smaller subsets of places, or not at all!!

If anything it was a useful exercise for me to cut my teeth on PHP & Javascript programming.

I've had a look at the output of Born's page and I think a function has become commented out. Line 92-93 should be as follows


      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {

I think Born will find these all on one line and thus the function is not called??

Cheers

Steven

Link to comment
Share on other sites

Hello,

I did wonder what would happen with loads of geo-coded places, as I said only about 100 of my 1,000 odd places thus far have geo-codes. One way to perhaps speed things up would be to remove the sidebar but this wont overcome the 'red blob' effect. However I appreciate with 1000's of places its probably better off trying to deal with smaller subsets of places, or not at all!!

If anything it was a useful exercise for me to cut my teeth on PHP & Javascript programming.

I've had a look at the output of Born's page and I think a function has become commented out. Line 92-93 should be as follows


      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
I think Born will find these all on one line and thus the function is not called?? Cheers Steven
Steven, The following lines need to be changed to work in TNG 7.0 Line 31
include($subroot . "config.php"); // for TNG 7.0 - for TNG 6.2 use include("config.php"); 
and line 38
include($subroot . "mapconfig.php"); // TNG 7.0 for TNG 6.2 use include($cms[tngpath] . "mapconfig.php");  

I don't have all my locations coded by any means. It took about a minute to create the map on my site http://www.royandboucher.com/genealogy/world_map.php

Link to comment
Share on other sites

Hello everybody,

thank you very much for your help with this. I'll check the stuff you recommended and I hope it works. The "misspelled" Javascript is correct. This line is added by my web-hoster to create the ad-layer.

Again thank you all,

Marco Born

Link to comment
Share on other sites

1.) Is there by any chance a way to not display the treename in the (for lack of a better description) places window to the right of the map?

2.) Is there by any chance a way to change the size of the map, by making it bigger? I managed to get places window wider, by increasing its size to 500. But when I raised the map style sizes from 550x450, increasing the width size just caused the map to redraw portions of the world already displayed (i.e. there would be 2 Americas, or 2 Asias, etc). And increasing the height size caused the map to remain at it's height, and only the top & bottom borders got bigger.

3.) One reason why locations with a lot of individuals end up being blobs is because of the size of the pins. Is there by any chance a way that we can change the markers, from a large pin to perhaps a much smaller red dot? This would allow each of us to individually change the color, and more importantly the size of the dot to best suit our own situations .... those with large number of locations can reduce the size of the dots to a point where they are ..... well, less of a blob :wink:.

Otherwise, all in all, I personally like this script 8-). I have less 700 locations (I think), so my map is not as bad as those of you with thousands of places. Hopefully someone knows a way of changing the pins to dots, and allow us to adjust the size of the dots. Thanks in advance.

Link to comment
Share on other sites

In answer to JMM's questions:

1) replace line 139 with


        echo "var marker = createMarker(point,\"$row[1]\",\"<a href='placesearch.php?tree=".$row[0]."&psearch=".$newloc."'>Go to places page for ".$row[1]."</a>\") \n";
2) line 113; replace the 1 with another number, probably a 2 or 3 would be best (this is the 'zoom' level) the other numbers (the zeros) are the lat & long so if you want to center on another location change this accordingly.

      map.setCenter(new GLatLng( 0,0), 2);

3) Its possible but the code changes are a little more involved, I'll have a think and get back to you...

Link to comment
Share on other sites

Version 2 with changes suggested by JMM. You will need to read the comments in the code and amend accordingly; you now have the option to reduce the 'pin' icon size, change the pin with your own icon, and remove or replace the 'shadows'

Hope this is useful

Steven

world_map2.zip

Link to comment
Share on other sites

Steven, in one word ...... awesome!!! I hope others find this (v2) release of yours useful too.

In my case, I have almost 3000 people in my tree. Not a lot, but not a small number either. In my case I've opted for a red dot for my icon. If others are interested in changing their icon too, they can try these for starters:

Google Maps Icons from a Google Maps API group

Google Maps API Tutorial - Google Earth Icons

I also played around with the icon size, and chose 25,25. This is rather large on the initial page, but when one zooms in, it's easier to distinguish from Googlemap's own city/town icons.

It seems that I needed to enlarge my map size to 1025 pixels wide, in order to be able to view the entire globe (dateline to dateline). And I widened the location window to 400 in order to eliminate word-wrapping. These bring the total width to around 1475, so only wrap-free & scroll-free viewable at 1680 & above. I'll have to wait & see if anyone complains. :roll:

All in all, Steven, I find this a fantastic add-on for TNG ... thanks for your time in creating this for us.

Regards,

John

Genealogy Wings

Note: If anyone finds an icon at the above locations that they want to use, right-click on the icon & save it to your TNG directory. Then modify line 98 of Steven's World_Map2 script accordingly. And as Steven mentions in the script, you may wish to chage the default settings on line 104 of his same script to suit your own needs.

Link to comment
Share on other sites

Glad to see a few people have already tried this and are getting good results, changing the icon for the red dot as per JMM seems to be the way to go, but the default code with just the reduced size pin and lack of a shadow makes the map considerably clearer.

Obviously those of you will 1000s of places will still encounter problems with the map taking a long time to display.

Cheers

Steven

Link to comment
Share on other sites

  • 2 weeks later...

This is semi-related... A couple years back Fox had an XMen fan site that allowed users to register for a free account and then their location would be shown on a world map. Users loaded one at a time on the map with little red dots and as it loaded there were more and more dots and it was a pretty neat effect. It used a lot of cpu power and wasn't real fast... nor was it very useful. The site has since been taken down and just redirects to a page where you can buy the movies.

Anyway, I'm thinking about doing the same sort of thing for all of people in my database for whom I have a birth date. One idea I had is to control how quickly dots appear based on the timeline. So for example, if one person was born in 1700 and then the next was 1720, there will be 20 unites of time between those two dots. Then if you have two people a month apart, it's going to be much much quicker. The end result will be the dots start somewhat slow and then get faster and fast until at the end several are appearing at once.

One neat thing about this is it will visually show the spread of my family across the country or around the globe or whatever (thus far my data is almost 100% US based). It should look pretty nifty.

Ideally I'm going to have a flash movie that pulls xml data supplied by a php script. This could end up being JSON data... either should work just fine. I want the config/install to be simple. Two files, the flash movie and the php script. The php script should pull it's data from TNG and need little if any configuration. The code to show the movie will just need the path to the movie and to the xml data source (the php script).

Thoughts? Ideas? Anyone interested in coding this or helping in any way? The php end of things will be a cinch but my flash skills are pretty much make believe... I've done a bit of research and I know Google Maps now has a flash api and that's what I intend to use.

I'll probably get started hacking on this in the next week or so after I finish up the Simile Timeline stuff I'm working on right now and my changes to the event map section.

-Gary

Link to comment
Share on other sites

Sounds very interesting, and I would be interested in something like this.

Unfortunately, I have basically no programming skils, so I can't help you there. But, if you need any testers, ..... ;-)

Best of luck.

Link to comment
Share on other sites

I've done something similar to what GaryT describes, but its all HTML not flash.

Basically its a mod to my word map. It takes all the births, where we have coordinates, and maps them. You then have hyperlinks on the map page which show 'all births prior to 1600, all births prior to 1650, etc etc).

As we are now dealing with a subset of locations (as opposed to all births, marriages, deaths etc) this ** should ** load faster than my world map for those with loads of locations, especially the early years.

I'm in the process of doing marriages & deaths, so if you think this is useful let me know and I'll post those files once complete.

You may need to hack the code a bit to amend default icons, zoom level and map size. Date range is 1600 - 2000 in 50 year blocks.

Cheers

Steven

birthsmapped.zip

Link to comment
Share on other sites

I've started on my flash version and it's going well except I'm having trouble getting them to not show all at once. Apparently there isn't a way to have the whole thing just stop for a specified amount of time but rather you have to use a timer which waits and then fires an event. The sample code I'm basing this on would work fine if I could just throw some sort of a pause in there but I'm not familiar enough with AS3 to move this part into a function. I'll get it at some point though.

Once I get that part figured out the rest will go fast.

-Gary

Link to comment
Share on other sites

I got a chance to work on this today and made some decent progress. Right now I have it running with some sample non-TNG data. The next step will be hooking it up to my TNG database which is trivial and then converting the colorizer to change the shade based on year rather than temp.

You can see what I have thus far here:

http://ashburngenealogy.com/geo/index.html

I'm debating what would look better between the colors like the are now, but based on year, or maybe doing pinks for females and blues for males. I'm open to ideas/suggestions/criticisms/whatever.

And of course as soon as I get this into a usable state I'll be sharing it with anyone who wants it.

Lastly, thoughts for the tooltip and what to show at the bottom? I'm thinking something like this for the tooltip:

Lastname, Firstname - Jan 15 2943

-Gary

Link to comment
Share on other sites

Gary,

I love your flash version, with your pins appearing one by one.

What I noticed was, the first time I display your flash map, it takes a few seconds for all the Googlemap panels to load. However, your pins are starting to appear before the map has finished displaying. I would assume that there's no way your code can know when the map panels have finished loading, so I guess there's no way around that issue. Once that flash map is displayed the first time, though, and the Googlemap panels are in cache, any refreshs or return to that page displays the map panels almost instananeously. And it looks great.

Steven,

I downloaded & tried your birthsmapped.zip file, and love that too. As you mentioned, I hacked it slightly to widen the width of the map & location list, and increased the zoom level of the map to 2. And as with your other map, I love this one too. With these 2 maps, and quite likely more in a short while, I need to start thinking about coming up with a page to list all the maps that I'll have available to viewers. :wink:

One thing: The links for 1700 and 1850 have a little error in them. When 1700 is clicked for example, the following 2 lines are displayed, instead of just the first:

The current map shows Births prior to 1700

The current map shows Births prior to 1750

And when 1850 is clicked, the following:

The current map shows Births prior to 1850

The current map shows Births prior to 1900

I fixed these by adding break; at the end of Case 3 and Case 7, as they were missing.

I'm also experimenting with the sort order of the place names in the right-hand column. I've tried sorting them alphabetically, by changing the order to p.place. But now I'm not sure if I want to do that or not. :roll:

In any case, to both of you, thanks greatly for making your maps availbale to us.

Regards & have a great weekend.

Link to comment
Share on other sites

Gary,

I love your flash version, with your pins appearing one by one.

What I noticed was, the first time I display your flash map, it takes a few seconds for all the Googlemap panels to load. However, your pins are starting to appear before the map has finished displaying. I would assume that there's no way your code can know when the map panels have finished loading, so I guess there's no way around that issue. Once that flash map is displayed the first time, though, and the Googlemap panels are in cache, any refreshs or return to that page displays the map panels almost instananeously. And it looks great.

I noticed this as well and it's something I plan to take care of. Ideally I'll be able to add code to check for the map being loaded. I'm fairly certain that the api supports this as the JavaScript api has that functionality. The sample code I'm working from showed all pins immediately so there was no need for that.

Unfortunately The Dark Knight opens this weekend and I'm heading out in about ten minutes to see it so I won't get to it tonight but I hope to have the first beta version ready by the end of the weekend and I've noted the loading issue and will get that sorted.

Thanks for the input! Much appreciated!!

-Gary

Link to comment
Share on other sites

thewillistree

Version 2 with changes suggested by JMM. You will need to read the comments in the code and amend accordingly; you now have the option to reduce the 'pin' icon size, change the pin with your own icon, and remove or replace the 'shadows'

Hope this is useful

Steven

Hi Steven,

Thanks for this code which is a great feature - I have just one query:

Line 53 - writelog( "<a href=\"/path_to_your_history_folder/this_file_name\">Your Title Here</a>" );

I'm not sure which file this should point to - can you advise? At the moment my code seems to be pointing somewhere else (see my World Map page

Paul

Link to comment
Share on other sites

Attached is a zip of all my current maps, the bugs spoted by JMM earlier have been fixed and everything is sorted by place name.

To recap;

worldmap.php - my original 'show me everything with co-ordinates' map

wordlmap_marr.php

worldmap_birth.php

worldmap_death.php

These show births, marriages and deaths, links at the top of the screen show a progession of events from 1600 to the current day in 50 year blocks and (newly added) just the events for each 50 year block.

worldmap_cen.php - details the census, again links at the top of the page show each particular census year or all census data. This needs a little more config, in that you need to add the census Custom Event Type and know the eventtypeID assigned to the census which means using myPHPAdmin (or equivalent) and then amending the SQL statements in the code..... Also this just has links to the census years I have in my tree.

finally with regards to Pauls comments I've no idea what line 53 does, this was in the Historytemplate which forms the basis of the page, but it does not seem to be important!!?

Cheers

Steven

maps.zip

Link to comment
Share on other sites

Line 53 writes to the file genlog.txt that the page was accessed so that it shows up in the showlog.php page on the site

http://YourSite/showlog.php

So in your use of it you might put

 writelog( "<a href=\"/worldmap_marr.php\">Map of World Marriages</a>" );

Roger

Link to comment
Share on other sites

thewillistree

Line 53 writes to the file genlog.txt that the page was accessed so that it shows up in the showlog.php page on the site

http://YourSite/showlog.php

So in your use of it you might put

 writelog( "<a href=\"/worldmap_marr.php\">Map of World Marriages</a>" );

Roger

Hi Roger - and Steven]

I figured out why my site isnt showing any locations - because I haven't allocated any with the long/lat co-ordinates! So at some time I'll go through my places list [currently around 1220], merge those which are obviously the same location but spelled different, or with an extra comma etc in them, then go through the list and allocate most of them to the long/lat locations.

Paul

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...