O.K. I see a few of things, some I can help with, some I can't.
1. Your SQL is trying to select the polygons that are within the points. To
fix this change:
from Tables: Points, Access_Routes
where Condition: Points Within Access_Routes
This may seem minor, but makes a difference.
2. The second issue is the 'into Table Named'. You have Points.Neq which
means you are trying to put the results of the count into a column in the
Points table. Unfortunately, you can't do this in the MI SQL query dialog.
It can only go into another table. Not sure how to get around this one yet.
I will work on this at my break (I'm at work now), and try to get something
back to you. May involve using Update Column.
3. Not sure if this will be an issue or not if Update Column is used,
but...If I run the query with the correction from number 1 above, I get a
count of all points the fall within both regions, not by individual region.
As I mentioned, I may have to get back to you on this.
Don Mitchell
-----Original Message-----
From: Alireza [mailto:[EMAIL PROTECTED]
Sent: September 15, 2004 11:23 AM
To: 'Hughes, Colleen / Don Mitchell'
Subject: RE: MI-L How can I count number of points in a region?
Did not work. Please see the attaching.
Thanks
-----Original Message-----
From: Hughes, Colleen / Don Mitchell [mailto:[EMAIL PROTECTED]
Sent: 15 September 2004 16:10
To: 'Alireza'; '[EMAIL PROTECTED]'
Subject: RE: MI-L How can I count number of points in a region?
To clarify, are the points and the regiopns part of the same TAB. That is,
does the Access_Routes.TAB contain both the points you want to count and the
regions you want to the points to be counted in?
The method I mention works if they are in 2 separate TAB's.
You could try: Select column: Count(*)
From Table: Access_Routes, Selection
Where condition: Access_Routes Within Selection
Group by column:
Ordered by column:
Into table name: NoOfPoints
This assumes that "Selection" is a TAB that has the regions that contain the
points you want a count of. If you have selected the region, Mi might refer
to this as Query1 (or Query2, or..... depending on how many times you have
selected something).
If the regions and points are in the same TAB, I'd recommend selecting them
into a separate TAB first. It is just good practise, in my opinion, to
always keep different object types (point, line, region, text) in separate
TABS. It may LOOK fine when used on a map, but can make queries or analysis
more of a pain than need be.
Hope this helps.
Don Mitchell
-----Original Message-----
From: Alireza [mailto:[EMAIL PROTECTED]
Sent: September 15, 2004 10:17 AM
To: 'Hughes, Colleen / Don Mitchell'
Subject: RE: MI-L How can I count number of points in a region?
Hi
Thanks for your email, but sorry I could not do it, although it is easy, but
something should be missing.
I have a table named Access_Routes.TAB, there are two region each on
contains some points, I selected one region, then I went to Sql, there are
some parts need to be filled and this is the way I filled out, which does
not work!
Each point has a value in a column named Ms in the browser table.
Select column: *
>From Table: Selection
Where condition: Count(*)
Group by column:
Ordered by column:
Into table name: NoOfPoints
This one does not work. Would you help me out?
Thanks
-----Original Message-----
From: Hughes, Colleen / Don Mitchell [mailto:[EMAIL PROTECTED]
Sent: 15 September 2004 15:11
To: 'Alireza'; [EMAIL PROTECTED]
Subject: RE: MI-L How can I count number of points in a region?
Hi Ali,
If you open the MapBasic window in MI Pro and run an SQL query for a count,
you get:
Select Count(*) from Points_tab, Polygon_tab where Points_tab.Obj Within
Polygon_tab.Obj into Selection
This will give you the number of points within a polygon. I hope this helps
get you started.
Don Mitchell
-----Original Message-----
From: Alireza [mailto:[EMAIL PROTECTED]
Sent: September 15, 2004 9:46 AM
To: [EMAIL PROTECTED]
Subject: MI-L How can I count number of points in a region?
Hi
Does any one know how I can count number of points in a region using
Mapbasic in Mapinfo??
Thanks
Ali
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 13351