3
$\begingroup$
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

$\endgroup$
  • 1
    $\begingroup$ 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? $\endgroup$ – C. E. May 12 '14 at 18:21
  • 1
    $\begingroup$ @halirutan I was able to reproduce the image without any error message. $\endgroup$ – C. E. May 12 '14 at 18:23
  • $\begingroup$ how about first picture change to 2nd picture? $\endgroup$ – BatbuyanMGL May 12 '14 at 18:36
  • $\begingroup$ this sample code is working ... my quistion is processing contourplot this image... $\endgroup$ – BatbuyanMGL May 12 '14 at 19:26
  • $\begingroup$ this list about 14400 units data... $\endgroup$ – BatbuyanMGL May 12 '14 at 19:28
5
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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