¿En qué "camino" cae un lat / long en particular? Shapefiles del censo de EE. UU.

I've imported US Census Shapefiles (All Roads) into SQL Serve 2008 R2. I'd like to find out what "road" a particular lat/long coordinates fall on. What does that query look like?

I'm new to GIS; searched around without luck. Thanks!

Here are the top 10 rows as a sample data set:

MULTILINESTRING ((-73.924385 40.865365, -73.92249799999999 40.866064, -73.920611999999991 40.866758999999995, -73.919215 40.867275, -73.918414 40.867584), (-73.92662 40.864525, -73.924385 40.865365))

LINESTRING (-73.91434 40.862521, -73.915523999999991 40.863040999999996, -73.917063 40.863690999999996, -73.918943 40.864463, -73.919361999999992 40.864809, -73.919996 40.865797, -73.920611999999991 40.866758999999995, -73.921213999999992 40.867692999999996, -73.921725999999992 40.868497, -73.922145 40.86915, -73.922343 40.869459)

LINESTRING (-73.91704399999999 40.867025999999996, -73.918414 40.867584, -73.919754 40.868114)

LINESTRING (-73.91911 40.859573, -73.919845999999993 40.859898, -73.921235 40.860476)

LINESTRING (-73.917913 40.869667, -73.918109 40.86987, -73.918269999999993 40.870035, -73.918643 40.870421, -73.919249999999991 40.871010999999996, -73.919671 40.872076)

LINESTRING (-73.917913 40.869667, -73.918109 40.86987, -73.918269999999993 40.870035, -73.918643 40.870421, -73.919249999999991 40.871010999999996, -73.919671 40.872076)

LINESTRING (-73.911771 40.868096, -73.913352 40.868777, -73.915183 40.869551, -73.91588 40.869847)

LINESTRING (-73.911227 40.871655, -73.91268 40.872292)

LINESTRING (-73.911227 40.871655, -73.91268 40.872292)

LINESTRING (-73.932523 40.854538, -73.932092 40.855157, -73.931654999999992 40.855754999999995, -73.929509 40.857341999999996)

preguntado el 01 de febrero de 12 a las 04:02

Hey @Yuck, I've added sample data from the geom column above. Thanks! -

There is a lot more questions like this over at GIS.StackExchange, which is dedicated to spatial data analysis. -

@Yuck check out the accepted answer below. It's exactly what I was looking for. The census shapefiles include road name and linearid which I understand is a uniquely identifying key for each road. -

2 Respuestas

The following returns the closest road to the search point specified. It was kinda slow until we added spatial indexes to the roads table.

DECLARE @search_point GEOGRAPHY, @search_buffer_metres INT = 50
SET @search_point = geography::STGeomFromText( 'POINT(174.083058 -35.410539)',4326 )
    ROAD_NAME,SHAPE.STDistance( @search_point ) AS MetresFromSearchPoint
    SHAPE.STIntersects( @search_point.STBuffer(@search_buffer_metres) ) = 1
    SHAPE.STDistance( @search_point ) 

Respondido 02 Feb 12, 00:02

This worked! Thanks so much... To help disambiguate intersections, how could I use, say, a vehicle's current heading to determine which of the of the overlapping roads a vehicle is current on? - Familia Ellery

just brainstorming on my previous question, what if I were to calculate the relative bearing for the first two points on the line and matched that against the vehicles heading? Or... what if I "hashed" the general/average magnetic course of each road before hand. Just random ideas here - Familia Ellery

This is a non-trivial problem, and probably won't get you a satisfactory answer here. The problem with trying to resolve the street of a house with the tiger data is that there isn't really enough information to make a good deterministic decision- all that the tiger files provide is the geographic coordinates for each end of a road segment, along with the name of the road and a few other bits of information.

My house is a great example of why this is difficult. The property is bounded by a residential road, a tertiary road, and an interstate highway. My house is set far back on the lot, and so the rooftop lat/lon is geographically closer to the highway than either of the other two roads. My address of course is on the residential street, but there is no way you'd be able to determine that from the data that you have.

Respondido 01 Feb 12, 22:02

+1 This is the reason why (for locations outside major metro areas) Google Maps is often inaccurate. - ¡Qué asco!

Yes, though they have the advantage of being able to leverage google street view, sat photos and many other data sources to enhance their geocoding. They put a pushpin right on top of my house. - Chris Shain

I don't need an address, I'm really just looking for linearid or "RoadID" which is a column provided on TIGER. - Familia Ellery

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.