Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

EDIT: solved, went for the solution as described below

I have a set of polygons defined in a xml file. I create a shapefile with Pyshp. This works fine.

But now i want to add labels to the polygons. The labels are defined in my xml like this:

  <shape id="1" description="WINTER SEASONAL ZONE II" color="#FF99D9EA">
    <polygon>
      <location lat="50" lon="-68.5"/>
      <location lat="40" lon="-68.5"/>
      ....
      <location lat="54.666" lon="-132.666"/>
      <location lat="54.666" lon="-105"/>
    </polygon>
    <polygon>
      <location lat="-47.1" lon="-65.9"/>
      <location lat="-34" lon="-50"/>
      ....
      <location lat="-43.333" lon="-74.333"/>
      <location lat="-45.75" lon="-74.333"/>
    </polygon>
    <label lat="41" lon="-40" text="WINTER SEASONAL ZONE II\n1 Nov - 31 Mar - Winter\n1 Apr - 31 Oct - Summer" />
    <label lat="41" lon="172" text="NORTH PACIFIC WINTER SEASONAL ZONE\n16 Oct - 15 Apr - Winter\n16 Apr - 15 Oct - Summer" />
    <label lat="-40" lon="77" text="SOUTHERN WINTER SEASONAL ZONE\n16 Apr - 15 Oct - Winter\n16 Oct - 15 Apr - Summer" />
  </shape>

The labels have their specific positions. Also, the number of polygons and labels per shape are not related in anyway.

What's the best way to go?

I thought of creating a second POINT layer with the positions from the label tags and draw this layer on top of the polygon layer.

is there a simpeler way?

share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.