Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8729157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:47:01+00:00 2026-06-13T08:47:01+00:00

I have a Shapefile from which I am extracting Geometry column and storing it

  • 0

I have a Shapefile from which I am extracting Geometry column and storing it into Table.
This is sample data stored in Geometry column which has 432 points.

0x000000000104AC010000AB3E57ABBBC4384127A08938705B57414F401361C3C43841C9E53F846C5B574190A0F8E1F6C438410F0BB5766E….

Now I want to extract each and Every point i.e. 432 points from the Geometry column and store it into another table. For that I am using ST_PointN column but it only gives me 1 point at a time. ST_NumPoint will give me 432 number but not all the points.

How do I extract each and every point from Geometry column and store it into DB?

Cheers,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:47:02+00:00Added an answer on June 13, 2026 at 8:47 am

    Take a look in first example of ST_PointN documentation:
    https://postgis.net/docs/ST_PointN.html
    and pay attention to generate_series part.

    It seems, your geometry is Linestring? Assuming, your geometry is in ‘lines’ table and you want to create ‘points’ table, something like that should work:

    SELECT ST_PointN(a.the_geom, generate_series(1, ST_NPoints(a.the_geom)))
    INTO points
    FROM lines a;
    

    In case, your original geometry is polygon, you have to tweak that query little bit, because ST_PointN takes linestrings as parameter:

    SELECT ST_PointN(
        ST_ExteriorRing(a.the_geom), 
        generate_series(1, ST_NPoints(a.the_geom) - 1)
    )
    INTO points
    FROM lines a;
    

    First and last point will be same in ExteriorRing of polygon. It’s up to your needs, whether you use ST_NPoints(a.the_geom) - 1 or ST_NPoints(a.the_geom). In first case, first point will be present also as last point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I downloaded the shape data from OSM. I have imported data from Shapefile into
I have a Shapefile (*.shp) which I am loading into the Database. I have
So I have an air application that I want to save data from into
I have a shapefile which is the national boundary line of Chile. If possible,
have written this little class, which generates a UUID every time an object of
I try to build my addon, but when I have commented code from this
hey there i have this code that should save a file from sql server
I have a javascript function which should filter a specific row from a shape
I have a Python dictionary that I generated from an arcgis shapefile. The dictionary
I have a ESRI shapefile (from here: http://pubs.usgs.gov/ds/425/ ). I looking to use python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.