3
$\begingroup$

I have following problem:

enter image description here

and

enter image description here

So far so good. But GeoListPlot[{test[[;; 2]]}, ImageSize -> 300] does nothing (produces a blank map).

Similarly, the code here when plotted using GeoListPlot[test] shows only three regions, when it should be five (and all 5 are individually plottable).

What am I doing wrong here?

$\endgroup$
8
  • $\begingroup$ Have you tried GeoListPlot[test[[;; 2]], ImageSize -> 300]? $\endgroup$ Commented Aug 11, 2015 at 19:08
  • $\begingroup$ @SjoerdC.deVries It works for the first one, but for the second on (code in the link) I still can't get all five, no matter if the {} are there or not. In that case, I get two pieces if I use the braces, and the other two if I don't. $\endgroup$
    – soandos
    Commented Aug 11, 2015 at 19:11
  • $\begingroup$ If you use Graphics instead of GeoListPlot it works. Might be because of the coordinates. What are they supposed to be? $\endgroup$ Commented Aug 11, 2015 at 19:29
  • $\begingroup$ @SjoerdC.deVries that really solves the problem. Is there a way to different sublists passed into graphics different colors? (that is what I was originally trying to do). As an aside, it seems the problem was that some of the regions had multiple polygons, and the others only had one, and you can't plot both at the same with with GeoListPlot for some reason $\endgroup$
    – soandos
    Commented Aug 11, 2015 at 19:32
  • $\begingroup$ Graphics[Riffle[test, RandomColor[] // Unevaluated], ImageSize -> 300] $\endgroup$ Commented Aug 11, 2015 at 19:33

2 Answers 2

4
$\begingroup$

Your lat/long data pairs look like {523679., 632989.} which appear to be in some form of DMS form (ddmmss., ddmmss.}. However, I believe that these are being interpreted as decimal degrees. Converting to decimal degrees (simplified conversion used assuming longitude is even number of digits consistent with your data):

data = test /. 
    x_?NumericQ :> 
     FromDMS[FromDigits /@
       (x // Round // IntegerDigits //
         Partition[#, 2] &)] // N;

Manipulate[
 If[s === "All",
  func[data, ImageSize -> 500],
  func[data[[s]], ImageSize -> 300]],
 {{func, GeoListPlot, "Function"},
  {GeoListPlot, GeoGraphics}},
 {{s, "All", "Section"}, {1, 2, 3, 4, 5, "All"}},
 ControlType -> SetterBar]

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ These polygons look like they are probably projected into a State-Plane Coordinate System. If we know which state they belong to they can be projected back with GeoGridPosition $\endgroup$
    – mfvonh
    Commented Aug 11, 2015 at 21:21
  • $\begingroup$ If the coordinates were the common "web mercator", you can convert them to GeoPosition coordinates doing GeoPosition[GeoGridPosition[merc/(6378137. Degree), "Mercator"]], where merc is any web mercator coordinate pair. $\endgroup$
    – FJRA
    Commented Aug 12, 2015 at 0:58
2
$\begingroup$

I think your problem is that you have coordinates that have been projected onto a cartesian system, I'm guessing a US state-plane system. Mathematica can deal with these, you just have to tell it what it's looking at.

So suppose these are from NY, in the eastern section. Then

test2 = test /. coords : {__?NumberQ} :> GeoPosition @ GeoGridPosition[coords, "SPCS83NY01"];

GeoListPlot @ test2

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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