Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.
demElev[path_, samples_] := 
 Module[{elevUrl, x, y, markers, dem}, 
  elevURL = 
   "http://maps.google.com/maps/api/elevation/json?sensor=false"; {x, 
    y} = path[[1]] - path[[2]]; 
  pnts = Table[
    path[[2]] + {i, j}, {i, 0, x, x/samples}, {j, 0, y, y/samples}]; 
  markers = 
   StringReplace[
      ToString[#], {"}, {" -> "|", "{" -> "", "}" -> "", 
       " " -> ""}] & /@ pnts; 
  dem = ToExpression@
      StringCases[Import[elevURL <> "&locations=" <> #], 
       NumberString] & /@ markers; Partition[Flatten[dem], 4]]
path = {{41.334387, 104.574955}, {51.02568, 120.563405}}
dem = demElev[path, 120]

ListContourPlot[dem[[All, {3, 2, 1}]], 
 ContourStyle -> 
  Directive[GrayLevel[0], Opacity[0.946], AbsoluteThickness[2.5`]], 
 Contours -> {688, 1101}, PlotLegends -> Automatic, 
 ContourShading -> None, ColorFunction -> "Thermometer", 
 Epilog -> {AbsolutePointSize[10]}]

How to draw contour plot not a sharp angle this picture?? 2Denter image description here

enter image description here

share|improve this question
1  
I don't understand the question and I suspect others will have a problem with it as well, could you try to say it in a different way? –  Pickett May 12 at 18:21
1  
@halirutan I was able to reproduce the image without any error message. –  Pickett May 12 at 18:23
    
how about first picture change to 2nd picture? –  BatbuyanMGL May 12 at 18:36
    
this sample code is working ... my quistion is processing contourplot this image... –  BatbuyanMGL May 12 at 19:26
    
this list about 14400 units data... –  BatbuyanMGL May 12 at 19:28

1 Answer 1

up vote 5 down vote accepted

When you look at the data you have imported from google, you see that the lie in a structured grid. Therefore, you can transform your list of points {{v1, y1, x1}, {v2, y2, x2}, ...} into a matrix of values. With this matrix of values you can work with all kinds of smoothing filters to smooth the heights. In your particular example, one row is exactly 121 values long. Therefore, we can create the matrix easily and use a GaussianFilter before using ListContourPlot

data = Reverse[Reverse /@ Partition[dem[[All, 1]], 121]];
ListContourPlot[GaussianFilter[data, 5], Contours -> 10, 
  ColorFunction -> "Pastel", 
  DataRange -> Transpose[dem[[{-1, 1}, {3, 2}]]]]

Mathematica graphics

Compared to your original plot this gives:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.