gis
What is ST in PostGIS?
From the manual: PostGIS has begun a transition from the existing naming convention to an SQL-MM-centric convention. As a result, most of the functions that you know and love have been renamed using the standard spatial type (ST) prefix. Previous functions are still available, though are not listed in this document where updated functions are … Read more
Google maps: place number in marker?
icon: ‘http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=1|FE6256|000000′ Looks fine with 1-digit and 2-digit numbers (from Mauro’s link)
How to intelligently degrade or smooth GIS data (simplifying polygons)?
Douglas-Peucker is definitely the right approach. There are some simple ways to access implementations of it in PostGIS and QGIS that I thought I would add here for those who come across this post with a similar question. The goal is to start with something like this: and end up with something like this: In … Read more
Determine timezone from latitude/longitude without using web services like Geonames.org
I had this problem a while back and did exactly what adam suggested: Download the database of cities from geonames.org convert it to a compact lat/lon -> timezone list use an R-Tree implementation to efficiently lookup the nearest city (or rather, its timezone) to a given coordinate IIRC it took less than 1 second to … Read more
Fast Haversine Approximation (Python/Pandas)
Here is a vectorized numpy version of the same function: import numpy as np def haversine_np(lon1, lat1, lon2, lat2): “”” Calculate the great circle distance between two points on the earth (specified in decimal degrees) All args must be of equal length. “”” lon1, lat1, lon2, lat2 = map(np.radians, [lon1, lat1, lon2, lat2]) dlon = … Read more
Loading a local .kml file using google maps?
The KML can’t be accessed since it’s on your local machine and google can’t access that since it doesn’t know how to get to localhost:8080
Is there an efficient algorithm to generate a 2D concave hull?
One of the former students in our lab used some applicable techniques for his PhD thesis. I believe one of them is called “alpha shapes” and is referenced in the following paper: http://www.cis.rit.edu/people/faculty/kerekes/pdfs/AIPR_2007_Gurram.pdf That paper gives some further references you can follow.
Convert a shapefile (.shp) to xml/json
What dassouki said. Get GDAL from http://www.kyngchaos.com/software:frameworks. Use it to convert a shapefile to GeoJSON like this: $ ogr2ogr -f “GeoJSON” output.json input.shp eg $ ogr2ogr -f “GeoJSON” /tmp/world.json world_borders.shp world_borders $ cat /tmp/world.json { “type”: “FeatureCollection”, “features”: [ { “type”: “Feature”, “properties”: { “CAT”: 1.000000, “FIPS_CNTRY”: “AA”, “CNTRY_NAME”: “Aruba”, “AREA”: 193.000000, “POP_CNTRY”: 71218.000000 }, … Read more
Best way to overlay an ESRI shapefile on google maps?
I like using (open source and gui friendly) Quantum GIS to convert the shapefile to kml. Google Maps API supports only a subset of the KML standard. One limitation is file size. To reduce your file size, you can Quantum GIS’s “simplify geometries” function. This “smooths” polygons. Then you can select your layer and do … Read more