so I want to do a simulation of the spread of a certain disease in California with spatial considerations.

As such, in order to carry out the PDE calculation, I will need to extract the region of each county and assign certain values to these regions.

A pictorial example will be as following, the numbers are values to be assigned to each region enter image description here

Is there any build in function to achieve that?

  • 2
    $\begingroup$ Run EntityList[EntityClass["AdministrativeDivision", "USCountiesCalifornia"]] to get a list of county entities. Each entity has a property called Polygon. Is that what you need? $\endgroup$
    – C. E.
    Commented Nov 17, 2019 at 8:01

1 Answer 1


Expanding on C.E.'s comment. One way to generate an outline map of the counties. The label is the index of the county in the list of counties, that can be changed as needed.

counties = 
  EntityList[EntityClass["AdministrativeDivision", "USCountiesCalifornia"]];

labels = Text[Style[ToString[#], 10], GeoPosition@counties[[#]]["Coordinates"]] & /@ 

GeoGraphics[{EdgeForm[Black], FaceForm[], Polygon /@ counties, labels}, 
             GeoBackground -> None,
             ImageSize -> 800]

enter image description here


Convert polygon to a Region

polygon53 = counties[[53]]["Polygon"];
region53 = 
 polygon53[[1, 1]] // Flatten[#, 1] & // Map[Reverse] // Line // 

enter image description here

To solve a PDE over the region using this example.

usol = NDSolveValue[{Laplacian[u[x, y], {x, y}] == 10, 
         DirichletCondition[u[x, y] == 0, True]}, u, Element[{x, y}, region53]];

Plot3D[usol[x, y], {x, y} ∈ region53, ImageSize -> Large]

enter image description here

The polygon is a list of GeoPosition in the ITRF00 datum. You may need to convert to a different datam / projection depending on your application.

  • $\begingroup$ Hi Rohit, thank you very much for your reply. I am still quite new to this Entity thing. Can I check if there is anyway if I want to solve PDEs with the region being California, or any of the entity? $\endgroup$ Commented Nov 19, 2019 at 12:45
  • $\begingroup$ Hi Yincheng, you are welcome. I have updated the answer with an example of solving a PDE over the region. If you need help with your specific PDE you should ask a new question. $\endgroup$ Commented Nov 19, 2019 at 18:05

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.