Saturday 21 November 2015

arcgis desktop - How to compute and fill One-way field in a street shapefile according spacial position


I think it is something complicate, but I hope someone could bring up any idea about.


I'm using ArcGIS10, and I have a "One-way roads" shapefile with a One-way field with Y/N. But I need to create a new Field for this layer containing F or T if:




  • F : The final point of the line is Northern and Western than the origin of the line.

  • T : The final point of the line is Southern and Eastern than the origin of the line.


An example,Example


Another Example:


Example2


Thanks for your time,



Answer



I apologize that I can't answer how to do it with arcgis but I made a successful test with Spatialite-gui. I created first a new Spatialite database and imported some road data from a shapefile. Then I executed these three SQL commands:


alter table roads add column from_or_to;


update roads set from_or_to='F'
where MbrMaxY(EndPoint(geometry)) > MbrMaxY(StartPoint(geometry));

update roads set from_or_to='T'
where MbrMaxY(EndPoint(geometry)) < MbrMaxY(StartPoint(geometry));

Finally I exported the table with a new and populated "from_or_to column" into a new shapefile.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...