Pages

Thursday, November 16, 2017

Creating MultiPoint Shapefiles with PyShp

Pyshp let's you create any type of shapefile.  Normally a point shapefile has one point per record.  But
Photo credit: VancouverMom.ca
you can also have a group of points tied to a single record in a Multipoint shapefile.  To create a Multipoint shapefile, you just use the "poly" method in the Writer. The poly method isn't just for polygons. It can also create polylines and polypoints (i.e. MultiPoints)!

Here's a simple Multipoint shapefile:


import shapefile

# Create our writer as a multipoint shapefile
w = shapefile.Writer(shapefile.MULTIPOINT)

# We'll create a single dbf field
w.field("NAME","C",40)

# Create a single-part, multi-point shape 
# by declaring the shape
# type after the parts/points list
w.poly([[[3,4],[5,6],[7,8],[9,8]]], shapeType=shapefile.MULTIPOINT)

# Create a record for this feature
w.record("Group1")

# Save the multipoint shapefile
w.save("mpoint")
Repeat the poly and record steps to add additional shapes. Add another nested list of points in the first poly method argument to add more parts to the same record

7 comments:


  1. I must say you had done a tremendous job,I appreciate all your efforts.
    Thanks alot for your writings.
    Waiting for a new 1...Please visit our wonderful and valuable website-
    For More Details Visit are Official Websites :

    http://kutarockcity.postbit.com/tips-cara-mengatur-pola-hidup-sehat.html/


    http://inempoker.bravesites.com/


    https://www.kiwibox.com/Inem/blog/


    http://murdock44.angelfire.com/


    https://gedheanune.blogspot.com/2017/11/bandar-judi-togel-aman-dan-terpercaya.html

    ReplyDelete
  2. Thanks for sharing this in here. You are running a great blog, keep up this good work.
    Check it out : AWS Training in chennai | AWS Training institute in velachery

    ReplyDelete
  3. Hadoop concepts, Applying modelling through R programming using Machine learning algorithms and illustrate impeccable Data Visualization by leveraging on 'R' capabilities.With companies across industries striving to bring their research and analysis (R&A) departments up to speed, the demand for qualified data scientists is rising.
    data science training in bangalore

    ReplyDelete
  4. Selenium is one of the most popular automated testing tool used to automate various types of applications. Selenium is a package of several testing tools designed in a way for to support and encourage automation testing of functional aspects of web-based applications and a wide range of browsers and platforms and for the same reason, it is referred to as a Suite.

    Selenium Interview Questions and Answers
    Javascript Interview Questions
    Human Resource (HR) Interview Questions

    ReplyDelete
  5. Very nice post here thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's. Machine learning training in chennai
    machine learning with python course in Chennai
    machine learning classroom training in chennai

    ReplyDelete