• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Plotting map locations on a web page

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Plotting map locations on a web page

    After some advice here. While In between contacts I am writing a web tool for a non profit research organisation that I am a member of.

    I want to be able to dynamically display on a map of the UK with locations based on Longitude / latitude that I pull back from a database based on certain criteria. For example if the query set returns :-

    Location Latitude Longitude
    Harby 52.85 -0.88

    How can I display this as a pin or a blob on a map of the UK?

    Any suggestions ??

    #2
    If the towns can be shown as reasonably simple shapes like circles or polygons etc. I suggest you take a look at Walter Zorn's freeware dhtml graphics package as he has done all the hard stuff for you. This is excellent.

    www.walterzorn.com

    If you want more complicated irregular areas that's a bit more difficult but possible using transparent gif images inside divs on a background map. Make them invisible and then change to visible when clicked on. You can also highlight areas using the jscript filters property.

    If you want some code examples I could bing a few on my webtulipe if you email me.

    Comment


      #3
      Ooops - just realised you want multiple pins - my quick'n'dirty was for a single pin by using MultiMap

      Comment


        #4
        Thanks for the reply Frank – Really this should be easy if I can just find the right direction to be pointed in..


        A sample map can be found here
        www.torro.org.uk/archive/ukmap.htm

        And the data set can be found here
        www.torro.org.uk/archive/

        So.. given the following data that I could query out of the database I.E.

        Event&nbsp &nbsp &nbsp &nbsp LAT&nbsp &nbsp &nbsp &nbsp LON
        WS&nbsp &nbsp &nbsp &nbsp 56.164&nbsp &nbsp &nbsp &nbsp -2.550
        TN&nbsp &nbsp &nbsp &nbsp 53.092&nbsp &nbsp &nbsp &nbsp -2.303
        TN&nbsp &nbsp &nbsp &nbsp 52.719&nbsp &nbsp &nbsp &nbsp -1.765
        TN&nbsp &nbsp &nbsp &nbsp 54.483&nbsp &nbsp &nbsp &nbsp -7.133
        TN&nbsp &nbsp &nbsp &nbsp 53.092&nbsp &nbsp &nbsp &nbsp -2.302

        I would want to place a symbol for a WS at 56.164 and -2.550 etc. A different query would return another set of values and hence different locations plotted on the map. The map image would always remain the same.

        I wonder if I were to some how convert the LAT LON values to pixels I could just use the old HTML MAP and put a blob on the map at the pixel location?

        Again any other suggestion would be really welcome at this stage.

        Comment


          #5
          hmmm,

          convert the LAT LON values to pixels - do that and then use dhtml to create a layer with your symbols (as gifs) positioned on it. should be pretty straightforward(?)

          Comment


            #6
            Re: hmmm,

            I will certainly look at a conversion to pixels but one thought is that the 0,0 pixel is in the top right corner - sadly this does not tie in well with LOG / LAT as it would need to have it in the lower Right corner – so there would have to be some horrendous conversion going on there in order to convert it and I am not sure that I could do this … perhaps if I invert the LOG LAT values it might work…

            Any way thanks to fiddle’s tip/hint I managed to add multimap to my LOG /LAT finder tool. I am not actually a ASP programmer so I am using this a learning curve… which really means don’t over criticise my basic pages

            www.torro.org.uk/misc/lon...on-lat.asp

            Comment


              #7
              Re: hmmm,

              Multimap is very good - I started using it on my campsite finder website (kwikbreaks) more or less when I first created it - within six months all the other buggers had copied me

              Comment


                #8
                Re: hmmm,

                Why on earth is conversion to pixels difficult? That's basic O level mafs that applies to any scaling prob regardless of what increases in which direction and what the origins are, viz:

                ypixels = ypixelsbottom + (ylat-ylatbottom) * (ypixelstop - ypixelsbottom) / (ylattop-ylatbottom)

                Or have I misunderstood the question again?

                Comment


                  #9
                  Re: hmmm,

                  Frank you have really helped my out here as that formula was just the conversion that I needed. Now that I can convert LAT LON to pixels the rest should be easy - I will report back tomorrow some time with the first draft of the page

                  BTW here is the formulafor the LON conversion.

                  xpixels = Round(xpixelsleft + (xlon-xlatleft) * (xpixelsright - xpixelsleft) / (xlatright-xlatleft),0)

                  Are you sure this was o-level ?? I dont recall it all

                  Comment


                    #10
                    Re: hmmm,

                    Right off now to swot up on DHTML layers - somthing else that I have not delt with before

                    Comment

                    Working...
                    X