Jump to content

WebViewer and Yahoo Maps


vi

This topic is 6132 days old. Please don't post here. Open a new topic instead.

Recommended Posts

var pos=location.href.split("?");

var info=pos[1].split(",");

var lat=info[0];

var lon=info[1];

var latlon = new LatLon(lat,lon);

// Create a Map object. Put your application ID in place of XXXXXXXXX

var map = new Map("mapContainer", "XXXXXXXXX",

latlon, 6);

// Make the map draggable

map.addTool( new PanTool(), true );

//Make the different views map/sat/hybrid available

map.addWidget(new SatelliteControlWidget());

//Make the map zoomable

map.addWidget(new NavigatorWidget());

// Create a POI marker object

marker = new CustomPOIMarker( info[2][color:red].replace(/%20/g," "), info[3][color:red].replace(/%20/g," "), info[4][color:red].replace(/%20/g," "), '0xFF0000', '0xFFFFFF');

// Add the POI marker to the map and display it (This one works with Lat Lon, but you can also use map.addMarkerByAddress and pass the address from FM

map.addMarkerByLatLon( marker, latlon);

Edited by Guest
Link to comment
Share on other sites

got some KML stuff, too - I personally like KML and just hope more programs would adopt it - especially some offline mapping programs like DeLorme. As with all my stuff - not very elegant and not a one-size-fits-all solution, but it might save some people some searching. The stylesheet can handle 11 different conditions and I made a different color icon to go with it (Feel free to use them - they are kinda ugly, but they work-- not easy to come up with 11 different colors...). For my purposes each service person has their color, so I can quickly get an overview of their territory and when you hover over an icon it will display the name of the site and when you click on it, it will expand and display what's in the

[color:brown]the stuff behind the ///are comments that need to be removed

I found it much easier to have the major part of the KML code in a calculation field in FM, rather than in the stylesheet, not like your average FM table is lean and mean to start with...

Here is the KML field in the FM database:

"&Site Number&"-"&Site Name&"¶ [color:brown]///will display when hovered over

REGnr.:"&Regnr&</p><p> "</p><p> department:"&dept&</p><p> "</p><p> Site Manager: "&SiteM::Name&</p><p> "</p><p> Serviced by:"&Ops::Name&</p><p> "</p><p> last visited: "&Reports::serviced&"¶ [color:brown]///will display when clicked on

#"&Ops::icon&"¶ [color:brown]///That's the nr. of icon used (color 1 through 11, 99 for not assigned)¶ "&Round ( Lon; 9)&","&Round ( Lat; 9)&"¶

"

The stylesheet is attached - just needs to be renamed to .xsl again.

All you need to do now is an XML export, name the file .kml use the attached .xsl file, specify FMPXMLRESULT and Unicode (UTF-8) and you have your google earth KML file ready.

ttc.txt

Edited by Guest
Link to comment
Share on other sites

Beautiful, we were using a couple of hundred data points so we created our a placemark schema and used a FileMaker export and stylesheet. It is pretty cool watching google earth fire up and scroll to your data points. We made the points float about the earth a little using:










				1

				relativeToGround

				,,



Just change LonCenter and LatCenter to your desired fields and you're good to go. Tt looks pretty funny but makes it much easier to view when you have a bunch of information on there.

Link to comment
Share on other sites

I am pretty new to this forum, but it can't be too much longer for the 'forum police' to arrive and moving this to a more appropriate thread......

btw. the KML file fairly easily imports into google maps, so no google earth is required, however, google maps puts the limit of datapoints to 100 - I am running this on earth with almost 3000....

also, got rid of the %20 and replaced it with a 'real' space in yahoo maps... see edited code in that post

OK- question to the FM experts... do you see any way how that relation can be turned around? You are looking at google earth click on one of your datapoints and it will pull up that record in FM?

Edited by Guest
Link to comment
Share on other sites

I am pretty new to this forum, but it can't be too much longer for the 'forum police' to arrive and moving this to a more appropriate thread......

How about this one. I did one better for you. lol. You got your own thread. I split this topic from the FM9: New Features Thread since it really deems its own topic. :

Link to comment
Share on other sites

In the words of the little girl from kindergarten cop: "I'm not a policeman, I'm a princess". Lol, police myself? Everyone knows that doesn't work, haven't you seen enemy of the state : ?

Link to comment
Share on other sites

That's awesome. We have been tinkering with the Google Maps and Google Earth APIs. With KML or the Webviewer you can do some pretty incredible things in filemaker now. I'm definitely going to "borrow" that code though.

Any idea when you're going to be putting this on your blogs? I'm (and probably a lot of other people : ) anxiously awaiting!

Link to comment
Share on other sites

OK...since we can now freely talk about maps and KML and all that.... let me repeat my question, since I think it will get lost between all those police-princesses :king:

:qwery: Question to all the FM experts... do you see any way how that relation can be turned around? You are looking at google earth click on one of your datapoints and it will pull up that record in FM?

Link to comment
Share on other sites

You are looking at google earth click on one of your datapoints and it will pull up that record in FM?

Well to some extent yes - Assuming you are making a web app... have fms etc.

You could I'm assuming add a hyperlink to each of these points on the map via the GMaps API. If that was to be possible, you could make query links like http://testsite/gmap.php?type=customer&id=15 for each relevant point on the map.

Then, the php file could pull up the data.

Likewise, you could probably do this via XML/XSLT as well - But i like php more.

If you are talking about embedding this in a web viewer - Possibly, but it depends on exactly what you want to happen / how you want it to behave.

[color:blue]Edit [ I just saw you said google earth... well part of the above is still applicable ]

Edited by Guest
Link to comment
Share on other sites

i was actually looking for something way less involved - all on a local machine and really inside FM, not PHP, or XML, or any of that exotic stuff :

e.g. the guy pulls up to his site, after he found it with google earth, or delorme, now he clicks on that mappoint.....'up pops' FM and displays the data for that site and he can complete his maintenance report..... sort of along those lines, but I guess there is no way of passing information to FM via a hyperlink....would be neat though....lots of possibilities.

Link to comment
Share on other sites

Yeah as most of you guys know already, I have been wanting for the longest time to build a radial community of addresses in a FM file using Google maps but I havent had the time to pick apart the API. :

if you can live with yahoo maps (which i prefer to some degree) 80% of what you need is already in the first post. you basically just need to define your query in FM and then have the javascript go through a loop for each found record and place it on your map. Of course the radius thing get much much easier, if you have your data with Lat/Lon, rather than address, since every .1 degrees lon is about 12 miles apart and in our hemisphere a .1 degree lat about 13 miles.

Edited by Guest
Link to comment
Share on other sites

but I guess there is no way of passing information to FM via a hyperlink.

Well that depends, what sort of hyperlinks can you run with google earth?

Assuming they're reasonably complex and allow interaction with the filesystem you could utilize FM's ActiveX API (via vbscript or apple script) to run a find script based on the id you pass over to it.

Might not be simple, but at least its localized.

Link to comment
Share on other sites

This topic is 6132 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.