# Identify and Assign Values to Regions in the Map

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

Is there any build in function to achieve that?

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

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 =

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

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


Update

Convert polygon to a Region

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


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]


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.

• 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? Commented Nov 19, 2019 at 12:45
• 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. Commented Nov 19, 2019 at 18:05