Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a .jpg that is a highway that spans multiple towns, and a shapefile with boundaries of these towns. I have georeferenced the .jpg so that it is aligned with the shapefile of the towns. My ultimate goal is to compute the distance of each town--ideally from its centroid--to the nearest point along this highway.

I am able to convert the georeferenced highway into a shapefile. I have converted the shpaefile of the towns to a set of points to ease the distance calculation. When I do the Near calculation under Toolbox, however, I do not get any distances computed.

When I try to do a Near calculation, I get Null for the distance. When I try a Spatial Join, I get a -1. I cannot figure out what issue I can be having.

I am using Arcmap in ArcGis 10.2.

share|improve this question
    
Can you provide a screenshot of the jpg? Strange that it contains 8 layers as most jpg files contain 3 bands - R, G, B. Have you tried downloading the road as a vector file? Alternatively, you may need to digitise the road layer manually. –  Fezter Aug 12 '13 at 5:11
    
Good idea Fezter! I hope the attached image helps. How exactly could I download such an image as a vector? –  user1690130 Aug 12 '13 at 5:48
1  
The image doesn't have multiple layers. What you're seeing in the table of contents are the colors assigned to different cell values. The cells with value 4 represent the road and are colored red. –  mkennedy Aug 12 '13 at 16:41
add comment

3 Answers 3

You have a few options for getting the road as a vector.

  1. You could download the Open Street Map road layer. This has been prepared by Geofabrik. You'd have to select out the road you're after.
  2. You could digitise the road manually. This involves creating a new polyline layer and tracing the road. It looks like you'll need to create a point layer too, for your cities.

Based on the image, it doesn't look like the red line is terribly accurate so I doubt your results would be very precise if you traced the road. I suppose it depends on your needs.

share|improve this answer
1  
Fetzer: in option 2, how does that compare to georeferencing? As I stated initially, I do feel comfortable overlaying the .jpg with a shapefile and georeferencing the .jpg to that shapefile so that it is stretched appropriately. Regardless of whether there is a better map out there, I do have another example for which I do have to rely only on the map that is given, so I am interested in learning the general approach to this problem. The other map is black-and-white, but even there it comes back with multiple layers depending on how dark parts of the scan are. –  user1690130 Aug 12 '13 at 13:41
    
Georeferencing the image simply places it in space relative to other data. It's still a raster, not a vector. To get the road and cities into a vector format you need to digitize the line and the points for the city. The link Fezter provided is probably the best place to start. –  Kevin Aug 12 '13 at 18:21
    
Kevin: I am trying to follow those directions (in addition to the ones you had supplied earlier). I am stuck with the Editing and Creating Features part. I have the Create Features box on the right hand side of the screen as that link shows, but I'm not able to get anything to pop up inside of it. What should I be doing with edit in order to get things to be generated within the create features? So I guess if you can say anything more about the digitization process that would be much appreciated. I don't understand what exactly I should be doing in edit as I'm unable to replicate the link. –  user1690130 Aug 12 '13 at 19:48
    
In ArcCatalog, you need to create a new polyline feature class. Right click in a folder, and create new feature class or shapefile. Once you have done that, add it to your map. Right click on it and edit it. You should see it appear in your Create Features box. Start tracing. –  Fezter Aug 12 '13 at 20:25
1  
This comment thread is not the place to discuss basic editing. Please make sure you've read this page and any other associated pages. Once you've done that, you should be able to draw the road. If you're still having problems, please edit your question and explain what you've tried. –  Fezter Aug 12 '13 at 23:35
show 5 more comments

As @Fezter indicates, it may be worth it to seek separate sources of data. It should be fairly straightforward given how general the data is. Have a look at either OSM or US Census' TIGER files.

Once you have those, including a point layer for cities, and assuming you just care about the distance to the nearest highway, not the specific point of intersect, you can just use a spatial join query, assigning to the point the nearest feature and the distance to it--this exists both in the tool box and from right clicking on the layer. Certainly the toolbox version allows you to define a distance field.

share|improve this answer
    
ako: After I've digitized the road, could you please walk me through how I can compute the distance? I've tried both Near and Spatial Join but to no avail. I converted the shapefile of interest to points, and for each point, I get a distance of -1 –  user1690130 Aug 16 '13 at 8:35
add comment

Let's assume that your image is georeferenced. You should see it on the map correctly located with respect to a base layer (you can add base layer using the black arrow next to the adding data icon).

If you have many roads, manual digitization can be avoided thanks to "raster to line" (or ArcScan if you have the license). But first you need to reclassify your jpeg with "spatial analyst" setting the colours/value that are likely to be some roads to "1" and the background to "0". (eventually, you can use "thin" to clean up your lines).

Now you have your lines and your points. Make sure that the reference system is well defined, otherwise use "data management > projection > define" to set your reference system system for your data.

Now you are ready for the "spatial join". Make sure that the match option is "CLOSEST"

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.