Hi,
Can someone help me with an example of a Query that counts multiple objects (points) inside multiple area's (mpolygons)?
Example: I've got multiple area's, and inside these area's are multiple points. I would like to see as a result the total number of points inside these area's... by area.
Thank you in advance,
Mark
Hello @MarkFissers1310
Please be more specific.
Would you be willing to upload your points and your dwg file for a speedy and detailed workflow?
Hello
You want to count objects like Points, Blocks/Symbols inside MPolygons !?
It's very difficult especially when you have complex MPolygons with multiples complex holes and sub-holes ...
Please a DWG ... Or 2 SHPs : one with Polygons / MPolygons and the other with Points ?
The Health, Bye, Patrice
Patrice BRAUD
How can I share sdf or shp files ?
Looks like both files are blocked...
Kind regards,
Mark
For SDF, click-and-drag the SDF. From the WINDOWS EXPLORER folder, left-click the SDF and drag it. Drop it here.
For shapefile: make sure all four parts are in a single folder. The 4 parts are (a) shp, (b) shx, (c) dbf and (d) prj. These are the minimum number of parts to a shapefile. You may have more parts (they'er extra) but the four mentioned are mandatory. You can click-drag-and-drop just like the SDF.
Before you click-drag-and-drop the zipped shapefile, you can create a compressed zip folder by RIGHT-CLICKING the folder then doing this: If you don't zip the folder, you'll need to click-drag-and-drop the ALL four parts as a GROUP or each part individually.
Thank you for the explanation (is much appreciated)
Hereby are two zip files containing the shp files + shx, dbf, prj, ...
Grtz, Mark
attached files
your data to a map, analyse, intersection to the sdf file, data table from the sdf to .csv which can be sorted and reported as you please. I chose access DB.
BTW no .prj files so your data is not georefernced as pointed out.
There are other ways that will get posted for sure.
It's very difficult especially when you have complex MPolygons with multiples complex holes and sub-holes ...
Good advice but unless I've overlooked something, these boundaries do not have any holes. Can't the OP simply use the SELECT command, window (most cases) and use the "### Found" information echoed at the command prompt?
Thanks for your reply.
Is it possible to get as a result something like the table below?
FeatId | Number | Type_N | Type_J | Type_R | Type_L |
1 | R05 | ||||
2 | R03 | ||||
3 | R02 | ||||
4 | R01 | ||||
5 | L04 | ||||
6 | L03 | ||||
7 | L02 |
I had something dynamic in mind rather than a manual selection ;o)
If you still need results from this dataset, take a look at the attached.
Looks nice 👍
I have 2 questions:
1) what is the workflow (query in AutoCAD MAP) to get this result?
2) is it possible to expand the data-table of the polygon shape-file with those additional columns?
Grtz, Mark
one method to add the columns
First set a geographic coordinate system. This should be done with all maps to georeference the data.
Next create a new SDF file with geometry set so surface
and 4 new properties Type_N,J, R, & L
Put the sdf into the map and find create a new feature in the right click menu in Display Manager and draw a polygon around all the polygons in your map
Analyze, original polygons, new polygons as source and overlay respectfully, set a new file name for the output file and finish
The new polygons will have the columns in the table where the desired data can be filled in.
The original polygons file can be removed from the map as it is no longer needed
The data files in the .zip have all the data decribed above. ME83-W is used as the GCS. The GCS is needed to create a new sdf file, so set the GCS first in the local of you data. Post for help if needed.
as for the excel file, export the data file to a .csv file and use excel, other spreadsheet or database software to work with the data.
1) what is the workflow (query in AutoCAD MAP) to get this result?
This is actually a new dedicated inquiry tool we're adding to our add-on software packages for AutoCAD and Civil3D. We felt it was likely users may want to report on counts per data value such as your case and others like total single family homes by subdivision block, etc.
2) is it possible to expand the data-table of the polygon shape-file with those additional columns?
Not currently, we need to add column adding capabilities to our data write driver first. Then we will add the ability to add these columns to the outer polygon data.
I do a similar operation using QGIS. It has many powerful algorithms for analysis that are not present in Map.
@MarkFissers1310 a écrit :Thanks for your reply.
Is it possible to get as a result something like the table below?
FeatId Number Type_N Type_J Type_R Type_L 1 R05 2 R03 3 R02 4 R01 5 L04 6 L03 7 L02
With this?
(defun c:extract_data ( / ss n e v data_lst-mp p lst_pt ss_pt dn dj dr dl nb ep data_p data)
(defun WriteExcel (data / xlApp wBook cells i j)
(setq
xlApp (vlax-create-object "Excel.Application")
wBook (vlax-invoke-method (vlax-get-property xlapp 'WorkBooks) 'Add)
cells (vlax-get-property xlApp 'Cells)
i 0
)
(foreach row data
(setq i (1+ i) j 0)
(foreach val row
(setq
j (1+ j)
cell (vlax-variant-value (vlax-get-property cells 'Item i j))
)
(vlax-put-property cell 'Value2 val)
)
)
(vlax-invoke-method
(vlax-get-property
(vlax-get-property xlApp 'ActiveSheet)
'Columns
)
'AutoFit
)
(vlax-put-Property xlApp 'Visible :vlax-true)
)
(defun f (l i)
(if (> i 0)
(cons (mapcar (function +) (car l) v) (f (cdr l) (1- i)))
)
)
(setq ss (ssget "_X" '((0 . "MPOLYGON") (8 . "polygons"))))
(repeat (setq n (sslength ss))
(setq
e (entget (ssname ss (setq n (1- n))))
v (cons 0 (mapcar (function -) (cdr (assoc 11 e)) (cdr (assoc 10 e))))
)
(setq
data_lst-mp
(mapcar
'(lambda (x) (ade_odgetfield (cdar e) "polygons" x 0))
'("FeatId" "Number")
)
)
(while (setq e (member (assoc 93 (cdr e)) (cdr e)))
(setq p (f (cdr e) (cdar e)))
)
(setq
lst_pt (mapcar 'cdr p)
ss_pt (ssget "_WP" lst_pt '((0 . "POINT") (8 . "points")))
dn 0 dj 0 dr 0 dl 0
)
(repeat (setq nb (sslength ss_pt))
(setq
ep (ssname ss_pt (setq nb (1- nb)))
data_p (ade_odgetfield ep "points" "Type" 0)
)
(cond
((eq data_p "N") (setq dn (1+ dn)))
((eq data_p "J") (setq dj (1+ dj)))
((eq data_p "R") (setq dr (1+ dr)))
((eq data_p "L") (setq dl (1+ dl)))
)
)
(setq data (cons (append data_lst-mp (list dn dj dr dl)) data))
)
(if data
(WriteExcel (cons (list "FeatId" "Number" "Type_N" "Type_J" "Type_R" "Type_L") (reverse data)))
)
(prin1)
)
Can't find what you're looking for? Ask the community or share your knowledge.