JonWillis
JonWillis

Reputation: 3147

Android MapView using existing GoogleMap API

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?

Upvotes: 0

Views: 489

Answers (1)

krishc
krishc

Reputation: 368

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?

Upvotes: 1

Related Questions