Importing kml file in google maps vs ArcGIS looks different

3783
10
09-09-2015 10:18 AM
MichaelSibilio
New Contributor

I'm trying to create a range map based on coordinates.  Whether I do it with code or by KML file in ArcGIS, my results are way different than importing the same exact KMLfile in Google Maps.  Any advise on correcting this to look more like Google Maps?  Keep in mind this application is ran completely offline, which is why I cannot use Google Maps

Here is the KML File:

<?xml version="1.0"
encoding="UTF-8"?>

<kml
xmlns="http://www.opengis.net/kml/2.2">

<Document><name>My document</name>

<description>Content</description>

<Style id="Lump">

<LineStyle><color>CD0000FF</color><width>2</width></LineStyle>

<PolyStyle><color>9AFF0000</color></PolyStyle>

</Style>

<Style id="Path">

<LineStyle><color>FF0000FF</color><width>3</width></LineStyle>

</Style>

<Style id="markerstyle">

<IconStyle><Icon><href>

</href></Icon></IconStyle>

</Style>

<Placemark><name>NAME</name>

<description>YES</description>

<styleUrl>#Path</styleUrl>

<LineString>

<tessellate>1</tessellate>

<altitudeMode>clampToGround</altitudeMode>

<coordinates>

98.63,85.02

43.08,79.07

26.97,70.88

18.8,62.3

13.47,53.5

8.57,44.8

3.58,36.35

-1.63,28.2

-6.93,20.33

-12.12,12.63

-17.17,5.02

-22.63,-2.25

-28.22,-9.43

-34.98,-15.7

-42.67,-21.08

-51.18,-25.62

-60.55,-29.12

-70.7,-31.12

-81.2,-31.18

-91.42,-29.72

-101.02,-26.97

-109.62,-22.85

-117.3,-17.83

-123.9,-11.9

-129.32,-5.05

-133.55,2.47

-136.9,10.3

-140.45,17.78

-144.75,24.98

-148.6,32.53

-152.02,40.37

-155.85,48.28

-160.8,56.27

-165.75,64.48

-172.62,72.78

171.35,80.83

98.93,85.17

</coordinates>

</LineString>

</Placemark>

</Document>

</kml>

Google Map View:

GoogleMapView.png

ArcGIS View:

ArcGISMapView.png

0 Kudos
10 Replies
MelitaKennedy
Esri Notable Contributor

I don't know how to fix it in Runtime, but you have coordinates that are 'above' the valid latitude for EPSG::3857 (Web Mercator) and the line is crossing the dateline aka +/-180.

0 Kudos
MichaelSibilio
New Contributor

Thanks for your response.  I am projecting using 3857.  Still causing an issue.

0 Kudos
NeilAyres
MVP Alum

Just had a play with this in ArcMap.

Arc draws the points in their order, so I just edited your coordinate list. Those last 2 at the beginning. Then I deleted 98.93,85.17 because it is very close to another point. Alos when you construct a line from these points, arc just connects the dots. So the part through SAm looks relatively smooth, but that over northern Russia has only a couple of points. I tried the smoothing functions in the Cartography toolbox, but Bezier or paek smoothing options didn't quite do it. You need a curve fitting algorithm, I know that Ianko's ET Geotools has these.

MichaelSibilio
New Contributor

I will take a look at the order of the coordinate list.  The list of coordinates is being generated from another application that I convert into KML.  I put them in the order they were received in.  I have tried it with coordinates using this small list of points, and using 400 points.  I still get the same result.  However, when I do it in with just points, it looks great.  It's just that strange line that crosses over.

0 Kudos
NeilAyres
MVP Alum

Thus indicating that there is something wrong with the order of the points.

0 Kudos
MichaelSibilio
New Contributor

I don't believe it's the order of the coordinates.  If I import it into the 3D Scene View it displays as a complete circle, which it should.  I did move the two coordinates at the bottom to the top.  If the range was much smaller, it should give me a range circle on the 2D Map.  I can post an example of a smaller range circle.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

Moving the 35th and 36th coordinates to the start of the list (and maintaining their order i.e. 35, 36, 1, 2...) gives the following:

It looks better on a WGS84 basemap:

Note I set the opacity of the basemap to 0.25 to give greater clarity.

Cheers

Mike

MichaelSibilio
New Contributor

Thanks for the input Michael.  I'm trying to do this in a c# application using the runtime SDK.  I can't seem to get a WGS84 Map like you have on your example.  I have reordered the coordinates and added more coordinates to smooth out the line.  Any suggestions on how to get a WGS84 Map with an Offline Application?

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

I was using one of the older WGS84 basemap services - ESRI_Imagery_World_2D (MapServer)​. Note that: "This map is in Extended Support and is no longer updated. Esri recommends that you use World_Imagery instead"

If you would like to use a WGS84 basemap in an offline app then you can either create a basemap tile package directly from your map (How to create a tile package—Help | ArcGIS for Desktop) or alternatively publish a service and extract a cache from the service, which is good if you have multiple users who need to generate different areas/scales of cache on-demand (ArcGIS REST API).

Actually, I too was doing this in C# outside of the KMLLayer for testing purposes:

string coords = "171.35,80.83;98.93,85.17;98.63,85.02;43.08,79.07;26.97,70.88;18.8,62.3;13.47,53.5;8.57,44.8;3.58,36.35;-1.63,28.2;-6.93,20.33;-12.12,12.63;-17.17,5.02;-22.63,-2.25;-28.22,-9.43;-34.98,-15.7;-42.67,-21.08;-51.18,-25.62;-60.55,-29.12;-70.7,-31.12;-81.2,-31.18;-91.42,-29.72;-101.02,-26.97;-109.62,-22.85;-117.3,-17.83;-123.9,-11.9;-129.32,-5.05;-133.55,2.47;-136.9,10.3;-140.45,17.78;-144.75,24.98;-148.6,32.53;-152.02,40.37;-155.85,48.28;-160.8,56.27;-165.75,64.48;-172.62,72.78";

GraphicsOverlay graphicsOverlay = new GraphicsOverlay();

graphicsOverlay.Renderer = new SimpleRenderer()
{
Symbol = new SimpleLineSymbol()
{
  Color = Colors.Red,
Style = SimpleLineStyle.Solid,
Width = 2,
}
};

List<MapPoint> mapPoints = new List<MapPoint>();

string[] coordPairs = coords.Split(';');
int counter = 0;
foreach (var coordPair in coordPairs)
{
string[] coord = coordPair.Split(',');
MapPoint mapPoint = new MapPoint(Convert.ToDouble(coord[0]), Convert.ToDouble(coord[1]), SpatialReferences.Wgs84);
mapPoints.Add(mapPoint);

Graphic graphic = new Graphic(mapPoint, new TextSymbol()
{
Text = counter.ToString()
});
graphicsOverlay.Graphics.Add(graphic);
counter++;
}

Polyline polyLine = new Polyline(mapPoints,SpatialReferences.Wgs84);

graphicsOverlay.Graphics.Add(new Graphic(polyLine));

MyMapView.GraphicsOverlays.Add(graphicsOverlay);

Cheers

Mike