Hi Bart,

You should be able to get this information by running a query to join the two tables, using the 'intersects' geographic operator.

I assume that each of your railway polylines has a unique name or number as an attribute. If so, the query should produce a table that looks something like this (using your example, and assuming the railway is line number 1):

Line County
-----------
1 Cornwall
1 Devon
1 Dorset
1 Hampshire
1 Surrey

I am doubtful as to whether the order returned will reflect the order in which counties are visited, and if the line went from Hampshire into Dorset and then back into Hampshire again, Hampshire would only be listed once. From your email though, I don't think this is a problem. If your railway polylines are broken into multiple objects for a single route, then each of those objects will be treated independently, and you will probably find duplicate rows in the output list.

To run this query, choose Query > SQL Select... from the Mapinfo menu and fill in the dialog box as follows (the dropdown boxes on the right of the dialog will list table and column names, and speed things up):

from Tables: your_Railways , your_Counties
Select Columns: your_Railways.Railway_ID , your_Counties.County_Name
Where: your_Railways.obj intersects your_Counties.obj
into Table Named: Railway_List

(Where your_Railways & your_Counties should be replaced with the names of your tables, and Railway_ID & County_Name replaced with the relevant attribute/column names)

If you tick the 'Browse Results' box then click OK, you should see a table showing the list. At this point I would probably transfer the list into Excel to tidy it up (with the Browser window active, choose Query > Select All, then Edit > Copy, and then paste into a blank Excel spreadsheet).

Hope that helps,

Andrew


Verspagen, B. wrote:
Hi,

I am trying to solve the following puzzle in Mapinfo:

I have a table/map with information on regions (counties in the UK). I have also drawn a layer of polylines into that map, these polylines represent railway lines. Obviously, when the railway lines are layered over the map of counties, they will "connect" some of the counties. I am looking for a way to automatically make a list of which counties are connected by each individual line. For example, if a line goes from Cornwall to Devon to Dorset to Hampshire to Surrey, and stops there, I would like a script/utility that generates this list (Cornwall-Devon-Dorset-Hampshire-Surrey).

I am not a GIS-expert (so please try to go slow in suggesting solutions), but this seems like a pretty standard problem to me. So I figured it would be a standard feature, or something for which people had written scripts. But so far I haven't found anything that helps.

I am using Mapinfo Pro 7.8, unfortunately don't have Mapbasic, but I am able to programme in a bunch of other languages (outside Mapinfo). So, a partial solution that generates some data that could be used further outside Mapinfo would already make me happy.

Thanks for any help.

Best regards,
Bart Verspagen


------------------------------------------------------------------------

_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l


--
Andy Harfoot

GeoData Institute
University of Southampton
Southampton
SO17 1BJ

Tel:  +44 (0)23 8059 2719
Fax:  +44 (0)23 8059 2849

www.geodata.soton.ac.uk

---------------------------------------
For further information about GeoData's
Training Courses, please visit:
www.geodata.soton.ac.uk/training
---------------------------------------


_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to