0
votes

I've searched SO and Google but not found any answers on this.

I am being passed the following data, and need to show it in android. http://maps.google.com/maps/ms?msid=214791092532835797516.0004bc20df4e3c6ddf92a&msa=0&ll=52.812827,-2.079865&spn=0.003761,0.011689&amp

Currently I display it in a webview with an IFrame as its only element. But I really need to display it in a MapView. I have created a MapView and got it working. I now need to show data in the MapView as shown in the url above.

Whilst I can see the lat/long values, is it possible to get the custom map, and add it in MapView?

1
From the link I can see that you have a traffic layer and 3 points with a custom pin on some locations. So are you asking how to do the same in mapView ?krishc
@krishnakanthc I know I can do the same in a MapView using overlays and adding in GeoPoints. What I want to achieve is, given just that URL can I extract the data and put it on a mapview, or ideally just pass the URL to the MapView and let it work it out. My current work around is to launch the Google Maps application with that URL as the data. However, I really need it to be within one application, so tried to use the map view instead, but have no idea how to even get the custom map data out of the URL.JonWillis

1 Answers

1
votes

Try getting to KML file from the URL, msid will match.

https://maps.google.com/maps/ms?msid=214791092532835797516.0004bc20df4e3c6ddf92a&msa=0&ll=52.812827,-2.079865&spn=0.003761,0.011689

Link to KML file will be: https://maps.google.com/maps/ms?ie=UTF8&authuser=0&msa=0&output=kml&msid=214791092532835797516.0004bc20df4e3c6ddf92a

You will have to parse KML to get locations

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
  <name>Untitled</name>
  <description><![CDATA[]]></description>
  <Style id="style3">
    <IconStyle>
      <Icon>
        <href>http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png</href>
      </Icon>
    </IconStyle>
  </Style>
  <Style id="style2">
    <IconStyle>
      <Icon>
        <href>http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png</href>
      </Icon>
    </IconStyle>
  </Style>
  <Style id="style1">
    <IconStyle>
      <Icon>
        <href>http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png</href>
      </Icon>
    </IconStyle>
  </Style>
  <Placemark>
    <name>The Octagon</name>
    <description><![CDATA[<div dir="ltr">This is the description for the octagon</div>]]></description>
    <styleUrl>#style3</styleUrl>
    <Point>
      <coordinates>-2.081995,52.812881,0.000000</coordinates>
    </Point>
  </Placemark>
  <Placemark>
    <name>Sports centre</name>
    <description><![CDATA[<div dir="ltr">This is the description for the sports centre</div>]]></description>
    <styleUrl>#style2</styleUrl>
    <Point>
      <coordinates>-2.080439,52.812202,0.000000</coordinates>
    </Point>
  </Placemark>
  <Placemark>
    <name>Blackheath lane</name>
    <description><![CDATA[]]></description>
    <styleUrl>#style1</styleUrl>
    <Point>
      <coordinates>-2.072489,52.813522,0.000000</coordinates>
    </Point>
  </Placemark>
</Document>
</kml>

I guess this will get you locations from the URL, but I am not sure how to customize android maps easily.

Update:

Parsing KML file, stackoverflow link: How to draw a path on a map using kml file?