Map Newbie - Add attribute to a point, based on its location in a shapefile polygon

Map Newbie - Add attribute to a point, based on its location in a shapefile polygon

DavidePresta
Contributor Contributor
1,384 Views
9 Replies
Message 1 of 10

Map Newbie - Add attribute to a point, based on its location in a shapefile polygon

DavidePresta
Contributor
Contributor

Hi all,

 

I am a Map newbie with respect to using the database functions (I use it a lot for coordinate transformations and to import and modify the style of shapefiles from within Civil3D), and I am looking for a way to achieve the following goal.

I have two sets of data: a set of points representing olive trees (SDF file with just the FeatID ,X and Y coordinates), and a series of polygons representing cadastral boundaries (SHP file with FeatID, COD_COM, FOGLIO and NUMERO as feature properties).

(I am attaching a screenshot, in magenta the points representing the trees)

DavidePresta_0-1649352245608.png


I need to come up with a table like the following

FeatIDXYCOD_COMFOGLIONUMERO
1627926,42769792428220,85510042D8522136
2627867,93196078428223,39710665D8522137
3627863,46500213428222,88577384D8522138
4627864,69357327428221,97341779D8523254
5627855,37218352428221,71465069D8523255
6627881,59115171428222,45224029D8523256
7627880,29642674428223,24827329D8523257
8627898,68089127428222,89874038D8523258
9627890,32975771428222,67887291D8524120
10627900,17092755428222,04463982D8524121
11627899,65114745428221,20350580G51721383
12627911,24066853428221,39123880G51721384
13627881,78331283428221,07835047G51721385
14627890,45576500428220,90358402G51730211
15627873,30302179428221,46020577G51730220
16627935,47502180428221,02610846G51730311
17627942,59758422428221,22023076I872768
18627934,63392309428221,95143105I872769
19627944,34278528428222,13916404I87210310
20627839,36610671428221,47523945I87210383

 

So the question is,

is it possible to add attributes to individual points, making them inherit them from the polygon they are enclosed in?

 

Attached are the files I'm working on.

 

If you think of a different way to get to the same result (the table, structured as above) any proposal is welcome. Thanks a lot to those who want to help me.

0 Likes
Accepted solutions (2)
1,385 Views
9 Replies
Replies (9)
Message 2 of 10

braudpat
Mentor
Mentor
Accepted solution

Hello

 

Please excuse my US/English !

 

1) YES it's easy with the "GIS Overlay" Feature - Command: MAPGISOVERLAY

 

2) Assuming you have a Point GIS File (SHP, SDF, SQLite, etc) and a Polygon GIS File (SHP, SDF, SQLite, etc) 

 

3) Please connect with FDO these 2 GIS Sources (MAPCONNECT) and Display ...

 

4) Command: MAPGISOVERLAY

 

5) -- Source : Point GIS File -- Overlay : Polygone GIS File -- Operation = Intersection

 

6) Next Screen : Click on Suggestion - Length = 0.1 (quite enough)

 

7) GO ... And see the result : a NEW GIS File with Attributes coming from the Polygon GIS ...

 

Is it OK for you ?

 

The Health, Bye, Patrice (The Old French EE Froggy)

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 3 of 10

Pointdump
Consultant
Consultant

Hi Patrice,
OK, Davide has 1 SDF with points and 4 Shapefiles with Polygons. So I guess you need to run the Analysis 4 times?
Dave

 

PtsPolygons_1.png

 

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 4 of 10

ChicagoLooper
Mentor
Mentor
Accepted solution

This same issue was addressed yesterday. Here are the highlights.

 

The BLUE circles represent manhole covers. The Manhole shapefile's attribute table is shown on the right. 

Image-1Image-1

 

The RED plygons represent parcel boundaries. The Parcel attribute table is shown at the bottom.

Image-2Image-2

 

Analyze both the BLUE manhole shapefile and the RED parcel shapefile using a Feature Overlay.

Go to Analyze Tab=>Feature Panel=>Feature Overlay Icon.

The goal is to determine which BLUE circles are inside a parcel and which BLUE circles are outside a parcel. For points outside, the data remains the same--no change. For points inside a parcel, a brand new SDF is created. The SDF will combine, or retain, all attributes from both the BLUE circles and the RED polygons. 

Image-3Image-3

 

Page 1 of 2 (Overlay Analysis). Input the Source, Overlay and Type, then click Next.

Image-4Image-4

 

Page 2 of 2 (Overlay Analysis). Name the new LAYER file and save the OUTPUT in your project folder. For Settings, keep the default values then click Finish. 

Image-5Image-5

 

 

Here's the result. A new SDF has been created. The manhole cover inside a parcel are BLACK SQUARES with YELLOW outlines while the BLUE circles are manholes that are outside.

 Image-6Image-6

 

The new SDF consists of square-shaped points (you may use any custom shape). The new attribute table is shown at the bottom. Here the new SDF is added on top of existing data--Blue circles are actually underneath the black squares. Notice the new BLACK squares have the same geospatial location as their original blue CIRCLES.

Image-7Image-7

 

Since the new SDF is a separate point file, you can also add the it to any drawing you wish.

 

To convert the SDF to shapefile format you can do this:

  1. Open a brand new drawing, assign your coordinate system. Use MAPIMPORT command to add the SDF--be sure to Create Object Data during the import procedure.
  2. After the import, perform MAPEXPORT on the newly imported points--be sure to 'add' the Object Data you created in step 1. The object data will populate the shapefile's database or dbf. Name and Save the new shapefile during the export procedure.
  3. During either import or export procedure, you may keep the attributes you like and delete the ones you don't need.

Chicagolooper

EESignature

0 Likes
Message 5 of 10

braudpat
Mentor
Mentor

Hello

My 2 answers are without AutoCAD
Yes he must run 4 times MAPGISOVERLAY...
If he wants the Infos coming from the 4 polygones types, he has to use as source the previous resulting intersect Point GIS SDF (for the 2nd 3rd 4th analysis)
I am clear ??
Bye, Patrice

By

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 6 of 10

Pointdump
Consultant
Consultant

Hi Davide,
This is cool stuff! I'm learning heaps. I really appreciate you posting your data.
So I guess after running the MAPGISOVERLAY Analysis 4 times you would use a join, and then voilà!
Dave

 

PtsPolygons_3.png

 

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 7 of 10

DavidePresta
Contributor
Contributor

Thank you very much for the quick reply, both to @braudpat and to @ChicagoLooper (of which I have already read many other very useful answers).
To answer @Pointdump, I am happy that the question arouses interest and is useful to others, and I also believe that the spirit of the forums is precisely sharing.


Now I would not like to take too much advantage of your availability but I have another question.


I need to give an order to the points that represent the trees, for example the number 1 to the first tree to the west and the last number to the last tree to the east, this order is not fundamental, the important thing is that the numbering follow some criteria instead of the random order they have now.

 

Do you know how I can do it?

Maybe through a calculated column that I can then use to label the trees.

 

Otherwise it occurs to me that I could start from the points I had initially as autocad blocks, insert a text inside the blocks (which are all the same), explode the blocks and use the express tools to renumber the texts following the X direction, but to this point I don't know how to add the information I have in the texts to the points to be exported in the SDF file.

 

As usual, any advice is welcome.

 

Thanks again

0 Likes
Message 8 of 10

parkr4st
Advisor
Advisor

west to east can be found by sorting on the easterly column 

 

Consideration?  should all the polygon data be in one fdo file?   mapimport each sdf polygon file to the same layer in a .dwg with OD and mapexport to fdo.   

create outer boundaries of each of the four areas as four polygons to a sdf.

analysis intersection parcels to the four areas to attach the area name to the parcel polygon data

analysis of that output intersected to the tree points to produce one table with all trees in all areas in one database

 

or

 

export from the data table to .csv each data set into a spreadsheet where the area name is added in a column

so all the data of all four areas is in the ss.  

 

output a .csv from the spreadsheet and mapimport to a new map as points for further analysis

 

just asking.

 

dave p.

Message 9 of 10

O_Eckmann
Mentor
Mentor

Hi @DavidePresta ,

 

You can number attribute of bloc in AutoCAD by adding X coord and empty number attributes, ATTOUT, sort on X growing to number, and ATTIN to import number.

 

 
Olivier

Olivier Eckmann

EESignature

Message 10 of 10

DavidePresta
Contributor
Contributor

Thanks  @parkr4st , I actually needed to merge the polygon data so I did as you suggested.

 

I made some changes to the workflow and describe it below for those with the same needs:

 

Preparation of parcels polygons

  • MAPIMPORT for every parcel Shapefile, making sure to insert them in the same layer and creating Object Data in the same Table
  • MAPEXPORT to a single SDF file containing all the parcel data

Preparation of tree point with increasing ID number

  • starting from a DWG file with the trees each represented by a block, I modified the block using the block editor and inserted a text (for example "X") exactly in the center, justifying it as middle-center
  • EXPLODE the blocks just modified. This leaves us with a series of texts "X"
  • TCOUNT auto-numbering with express tools ordering in the X direction. This leave us whit a series of text numbered ascending from left to right
  • MAPEXPORT to SHP under "Selection - Object type" just use TEXT. This creates a point feature class with an attribute of the actual text value

After that I followed the instructions you gave me in a new file:

  • MAPCONNECT with FDO the single SDF file of parcels and the SHP of numbered trees
  • MAPGISOVERLAY Source : Point SHP File -- Overlay : Polygone SDF File -- Operation = Intersection

DavidePresta_0-1649674179559.png

 

Thanks everyone for the help