Given a geoJSON representation of each US state (such as found here), along with user location coordinates (as available via CLLocationManager), what would be the best way to identify which state is the user in? What is the standard way to parse the geoJSON file, and simply identify which polygons contain the user location?
Let's say my location is in Indiana. I'm looking to create a function that parses the geoJSON representing the US, and identify that the user location only falls within the boundaries of Indiana coordinates.
Any suggestions/tips here is appreciated.
I am looking to convert UGC or FIPS6 geocodes to polygons (or even rough lat/lng coordinates + radius). An example of the geocodes can be found here: http://alerts.weather.gov/cap/us.php?x=0
Anybody knows where I could find a mapping for these geocodes?
The data used by the NWS can be found here:
http://www.nws.noaa.gov/geodata/
In order to actually get the coordinates from the data, I used the program OpenJump to save the data in the CSV format.
Updated Answer for June 2019
The NWS Public Forecast Zones can be downloaded as a shapefile from https://www.weather.gov/gis/PublicZones
I used QGIS to convert the shapefile to WGS84 (EPSG:4326) and exported to CSV using WKT geometry. That resulted in a 122MB CSV file.
Instructions for Windows QGIS 3.4.3
Download and extract z_02ap19.zip
In QGIS, Layer -> Add Layer -> Add Vector Layer... (or press Ctrl+Shift+V)
Source Type = File, Encoding = System, Vector Dataset(s) = z_02ap19.shp extracted eariler. Then click Add.
Result
[Optional] Right click the layer, Set CRS -> Set Layer CRS... and set the CRS to EPSG:4326.
Right click the layer, Export -> Save Feature As...
Format = Comma Separated Value [CSV]
Choose a file location.
Choose an encoding, usually System or UTF-8.
Uncheck "Add saved file to map"
Make sure all fields are selected
Geometry type should be Automatic (They all end up as Polygons)
Layer Options:
CREATE_CSVT = YES (Creates a single file that describes the field types, useful for re-importing the file back into other GIS programs)
GEOMETRY = AS_WKT
LINEFORMAT = CRLF (Windows) or LF (Unix), historically, but most programs now can handle both
SEPARATOR = COMMA (Up to you)
STRING_QUOTING = ALWAYS (Likely doesn't matter as the data won't contain quotes anyways)
WRITE_BOM = NO (Byte-order mark, up to you)
Click OK, and QGIS will generated the file which takes several seconds.
Has anyone used the ogrinfo [-spat xmin ymin xmax ymax] option in the GDAL tools? I am able to run the - sql query on the shape files and get the answers/shapes but however if I use the lat/long values in spat, I dont get the results (However I dont get an error). I could not find an example at all.
This suggests one of three options:
Your file is not georeferenced as you expect
Your area of interest extent values are entered incorrectly
There are no features that both match your sql query AND lie within the extent as you have defined it.
You can test your understanding of the -spat values by creating a polygon to match and overlaying it in (say) QGIS to see how it overlaps with your data. This will quickly help you eliminate the options above. After that - you'll understand the feature for future use :)
I'm attempting to stream Tweets from the UK as a whole, using Twitters stream API, however I'm having trouble with my bounding box.
The LAT/LON pairs I'm using to define a bounding box of the whoe UK(Ire included) is as follows.
-9.05, 48.77, 2.19, 58.88
However when I try to use this with the Twitter stream API, it states the following error message.
Location track must be less than 1 degrees on a side: LocationTrack(48.77,-9.05,58.88,2.19)
I can't imagine that Twitter do not allow you a specify a bounding box that covers an area that crosses between the negative/positive LAT. Am I missing something here, or would this mean that Twitter only allow you to stream if you are in the Wester hemishphere, effectively?
If anyone has a suggest as to how I might be able to over-come this, I'd be very interested in hearing you out.
The reason for this is ambiguity around the meaning of the word 'degree' in this error.
Due to the lat/lon coordinates being used, I assumed it meant the actual VALUE of the degree in the second lat/lon pair, where as in actual fact it means the SIZE of the bounding box.
My bad.
I'm working on a project that contains Thomas Brothers Map page and grid numbers. Is there a way to programatically convert from this map page to a latitude & longitude?
An Example would be for the intersection of the US101 & I405 freeways.
ThomasBrothers: 561-3G (page-grid)
Not that I know of, but I don't have a lot of experience with Thomas bros maps. Are you talking about printed version of the maps or is there a link somewhere to an online map?
If you just need a few lat/longs, then you can look up the locations that correspond to the grid and get the lats and longs manually at many websites, including http://itouchmap.com/latlong.html
If you provide a link to a Thomas bros map that you are using, I might be able to help further.
By looking at the link above, you can determine that US 101 and I-405 has a latitude of 34.16073390017978 and a longitude of -118.46952438354492.
Your best source would be the map publisher. If they choose to help, someone there can tell you exactly what you need to know. If they won't help you, it's unlikely that they've released the information to anyone else.
If that's the case, you could do some work by hand to correlate one point from the map grid to your target coordinate system. Effectively, you could reverse engineer a mapping "datum" for each page. You'd also have to know what map projection was used to render the maps, so that you can calculate the transform from the map coordinates to the geographic coordinates as you move away from your "origin". Finally, you'll need to establish the orientation of the map, since different notions of "north" exist.
It sounds like the Thomas maps use a new grid for every page, rather than bleeding the grid continuously from page to page. If that's the case, you'll have to correlate one point on each map. For example, find a spot where a map grid intersection coincides with a notable road intersection. Then you can find the coordinates of the road intersection using a map with latitude and longitude (a topographic map, TerraServer, etc.). Doing this with two points on the same vertical grid line should help you establish the north used on the map as well.
The short answer is that each of the nine regions has a grid derived from a Lambert conformal conic projection with custom parameters, so you cannot write a conversion program without the parameters.
I've also got ThomasBros. pages that I would like to convert to lat/long for lookup against Google Maps API. They also provided something called TBXY ... not sure what this is -- perhaps some notation for GPS/lat/long?
<Area>"El Cajon"</Area>
<ThomasBrothers>"1297 5E"</ThomasBrothers>
<TBXY>"6481390:1827008"</TBXY>
Thomas Brothers Maps invested a lot when developing their GIS system to create their digital mapping system. Though the first "digitally produced" map was Sacramento County-1990, the development began back in 1986. I expect that their map projection equations are a well guarded trade-secret, which Rand McNally now owns. I'd don't know those equations, but would also like to know them.
There are 9 projections covering the 48 states. If you know the equations for Los Angeles, it is valid across California & Nevada. Oregon & Washington have their own projection. Arizona, New Mexico, Colorado, and Utah share another projection.
I do know this...
As many know, the page grid is an exact 1/2 mile square, or 2640 feet by 2640 feet. The coordinate measurement unit is 1 foot.
To determine the Thomas Brothers XY Coordinate, get one or more of the Thomas Guide CD- ROM maps, which were recently discontinued. The last ones produced for certain California counties were the 2008 edition. Last editions for Seattle, Portland, Las Vegas, and Phoenix/Tucson were the 2007 edition. Each is still available on the Rand McNally website for $20.
When you geo-code a group of addresses, you'll see an output file with the TGXY coordinates and Lat/Lon for the addresses you specified, and the page # and grid that point is in. Once that file is open, you can click on the map to add additional geo-coded points, which will also provide both the coordinates. The output file is saved in an Access database ".mdb" file.
If you know a lot about map projections or solid geometry, the set of corresponding TGXY and Lat/Lon coordiantes will provide you some good data for testing.
As you mentioned San Diego Page 1297, I'll provide its bordering coordinates.
West x=3062760
East x=3086520
North y=0985040
South-y=0966560
This is not in range of the "TBXY" you found on Google. Maybe it's the same projection, with a relocated origin.