Can anybody help me out with some code...

to get me started

I know a little SQL [mySQL is what my hosting service offers], a little less PHP and even less Java - I am fighting the local live API - but I need to get some mappoints [name, lat, lon] pulled from a SQL database (actually it does not have to be sql, since our main database is filemaker pro and it is not sql - so if it can be done from a csv, or excel, or something along those lines... just as well] and map them... I actually have a ton of mappoints [4000+], though having them pulled based on the map that is showing might be too much to begin with.....

Can anybody point me to some code that gets me started

 

Thanks a lot

elwood




Answer this question

Can anybody help me out with some code...

  • sapo

    Thanks guys.... and John got it right.... server side.... yup, not on my watch.... While I am impressed with the news site, I would not even have the slightest clue how to attempt that.

    The whole thing seems to be way too complicated for me to even tackle - I thought we are talking about a simple loop that calls the next record in the sequel database and places the info on the map .... that is about as much as I can handle....

    I guess i'll have to look into MapPoint online and see how much they charge for it.....

    thanks



  • CoDeR X

    Currently you are going to struggle. Ideally what you need to do is be able to transform your data (4000+ points) into a standard GeoRSS format. Then with a few lines of code (copy and paste) you could display them with ease. Currently this won't work.

    What i think is missing, and have suggested that i build, is some javascript that takes a GeoRSS collection and your map object and does all the work required to only show visible points, some clustering logic etc.

    This is all very doable, but i am struggling for time. Are there others that would help me It would all be in javascript but even if your not into js testing would be great.

    At the moment your best bet is to look at articles / post relating to using AJAX to call your sever side code to query the database for the visible points only / apply any clustering etc. My article on ViaVirtualEarth may help you out but it is .Net2 and will not convert to PHP easily.

    John.



  • Mongsreturn

    Actually, I'm not sure John's answer is necessarily the way to go. I've got a couple of sites (http://www.calebthompson.com/projects/newsmap/default.htm and http://www.calebthompson.com/projects/newsmap/history.htm) that query a SQL database and creates a pushpin for each location. If more than 1 pin appears at the same location, it simply appends the information to the first pin. Granted, it doesn't do clustering any fancier than that, but it works (when the SQL server isn't on vacation...) pretty well at reducing clutter on the map and getting a lot of info on there.

    Here's the basic idea: create a server-side page (ASP.NET in my case) that queries the DB. The page takes the returned results and generates a VE-friendly javascript string that it returns to the calling page. In other words, it will return something like:

    var p = new VEPaushpin(blah, blah, blah);map.AddPushin(p); p = new VEPushpin(etc etc);

    Then create your main map page, that loads the map, does all the other UI stuff, and calls the server-side page. When the server-side page returns the javascript, you call eval() on the returned value. Viola! Pushpins get added to the map, and all the heavy lifting is server-side, so your main page doesn't suffer a massive slow-down with each call.

    So what you're up against here is a) creating the server-side page to query the database and b) creating a basic map page to display the results. The pages linked above took me a day or two to hammer out.

    Hope that helps,

    Caleb


  • Latso

    Thanks - I guess I'll have to learn a lot more than I was hoping for - the copy and paste method, even if it did work is not going to help, since the information updates too frequently - I would be copying and pasting all day long.

    Anybody know of any commercial site/software out there that can get this accomplished I am basically looking at displaying up to 4000 mappoints across the US and depending on their status (done, due, overdue, etc.) have different color icons. It would be really nice if more information was available upon clicking on a mappoint, but that would be gravy and not vital.....

    thanks



  • Johan Nyvaller

    But you have to admit for someone that just want to put 4000 pins on the map being able to do it simply in js would be great.

    I got the impression that in this case the knowledge wasn't there to do anything serverside. Yeah the basics of the cluster stuff is simply appending the info from overlapping pins into a single pin, and to reduce the number of pins being rendered by showing only those that are currently visible. Now surely that could be acheived pretty easily in javascript The initial hit to load the massive GeoRSS won't be great but still better then tring to load all 4000 points.

    Clearly server side would be faster, scale better etc but does require a lot more work for someone new to the whole thing.

    John.



  • Can anybody help me out with some code...