geospatial

Converting from Latitude/Longitude to Cartesian Coordinates with a World File and map image.

I have a java applet that allows users to import a jpeg and world file from the local system. The user can then "click" draw lines on the image that was imported. Each endpoint of each line contains a set of X/Y and Lat/Long values. The XY is standard java coordinate space, the applet uses an affine transform calculation with the worl...

Ruby implementation of conversion between Latitude/Longitude and OS National Grid Reference point?

For converting between Latitude/Longitude and UK's Ordnance Survey National Grid eastings and northings, this seems to be the most popular explanation and reference implementation in JavaScript: http://www.movable-type.co.uk/scripts/latlong-gridref.html The web is littered with other implementations in different languages. Making the co...

Convert GeoTIFF to JPEG and Extract GeoTIFF Headers in Python

I am making a Python script which will read in a GeoTIFF file, and will do both: convert the GeoTIFF into a static JPEG (that is much smaller in size), and create a separate text file which contains the GeoTIFF headers. Using the Python GDAL API, I am able to get the script to open a GeoTIFF file, and print details, such as the RasterXS...

Selecting a good SQL Server 2008 spatial index with large polygons

I'm having some fun trying to pick a decent SQL Server 2008 spatial index setup for a data set I am dealing with. The dataset is polygons, representing contours over the whole globe. There are 106,000 rows in the table, the polygons are stored in a geometry field. The issue I have is that many of the polygons cover a large portion of t...

MySQL GIS and Spatial Extensions - how to map regions and query against them

I am trying to make a smartphone app which will return a list of users within a certain proximity, say 100m. It's easy to get the coordinates of my BlackBerry and write them to a database, but in order to return a list of other users within 100m, I need to pull every other record from the database and compare the distance between the tw...

Fitting place names into map shapes

I'm drawing shapes using GDI+ using a list of lat/lon floats, and I need to place the name of the place within the borders of the polygon. Simply centering the text in the bounding rectangle doesn't work for irregular shapes. I have the text and the font so I can get the size of the rectangle that the text will need to fit in, but at th...

What is the unit in returned by MySQL GLength method?

I want to get the length in meters between 2 points in the surface of the Earth. But the GLength method returns an unexpected value http://dev.mysql.com/doc/refman/5.0/en/geometry-property-functions.html#function_glength SELECT GLength(GeomFromText( 'LINESTRING(-67.8246 -10.0073,-67.8236 -10.0082)', 4326)) actual result 0.0013453...

Directional Map Search

Hello, I am trying so write a bit of code that will search for a given point on a map, but in a given arc of a compass bearing. e.g. 45 degress (north-east), 20 degrees either side. So far I have got a SQL command that will give me the results in a given radius, need some help on how to filter it to a direction. SELECT * FROM (SELECT ...

distance between two points across land using sql server

I am looking to calculate the shortest distance between two points inside SQL Server 2008 taking into account land mass only. I have used the geography data type along with STDistance() to work out point x distance to point y as the crow flies, however this sometimes crosses the sea which i am trying to avoid. I have also created a p...

Does SQL Server CE support synchronization of Spatial Data type?

Does Sql Server support replication to SQL Server CE? In the documentation, SQL server CE seems to be not supporting the st_geometry type. ...

Determine outer boundries of polygon from lat/lng point array

I have a large array of lat/lng points. Could be up to 20k points. I'm plotting them using KML. What I want to do is to take only the outter most points and use them to draw a polygon instead. I already know how to draw a polygon in kml, I just need to figure out how to select only the outer most points of the group. Any ideas? I'd like...

Android: how to get the walking distance between two geo coordinats?

I used this query URL http://maps.google.com/maps?q=from+A+to+B&output=kml ,which is given in the answer to this question. But after I tried it, it doesn't work with coordinates. It works with address names tho. I guess I could use google's geocoding to get the addresses first. But I wonder if there is another way to get the w...

Use GIS to get geographic info for a single point

I am not quite sure where to start with this. I only just started looking into this in the past week, but hopefully someone can help point me in the right direction. The goal of my project is to be able to take a geohash, decode it to latitude and longitude, check the point against some GIS data, and find out some information about that...

Given the lat/lon of 2 close points on earth (<10m), How do I calculate the distance in metres?

I have the lat/lon of 2 points on the earth. They are really close together, <10m. Let's assume the earth is flat. How do I calculate the distance between them in metres? I know about tools (PostGIS, etc.) that can do this correctly, however I'm just doing a rough and ready type, and I'm OK with low accuracy. At such small sizes a diffe...

Unable to retrieve computed distance in Spatial Solr queries

I'm using this plugin to allow spatial queries in Solr. I have followed the steps included in the documentation and I've got the spatial queries working fine. Now I want to retrieve the computed distance. I added these lines in the solrconfig.xml file: <searchComponent name="geodistance" class="nl.jteam.search.solrext.spatial.GeoDistan...

how to sort rows by a distance from a given point, mysql?

I'm trying to get 100 points from my table with a lowest distance to a given point. I'm using SELECT *, GLENGTH( LINESTRINGFROMWKB( LINESTRING( ASBINARY( POINTFROMTEXT("POINT(40.4495 -79.988)") ), ASBINARY(pt) ) ) ...

Point of latitude and longitude inside a complex spherical polygon

Question What R package has a function that can determine if a coordinate is within a closed, complex spherical polygon (i.e., a point inside a polygon on Earth's surface)? Related Links JPL: Formulae and explanation Java: Spheres software SO: Point inside or outside polygon SO: Point straddling the meridian SO: Point in polygon hit ...

How to find "nearby" results?

Assuming you have the latitude and longitude of your user, and you want to find nearby... let's say restaurants, how do you query your relational DB? For something like "restaurants within a 25 mile radius"? Would you just query for restaurants in a square with a long and lat greater than/less than the user's loc +/- 25 miles (converte...

can i MySQL select where row's co-ords are < x miles from target coords? (mysql proximity search)

There's a few questions like this on Stack Overflow but because i can't find any quite similar enough for me to follow. I'm looking to select rows from db which are within x miles of a target. example table columns: | city_name(varchar) | lat(decimal) | lon(decimal) | query effect i'm looking for (either using php or mysql) $target...

Alternatives to GeoWebCache?

Does anyone know alternatives to GeoWebCache (GWC)? There's TileCache, but it seems to be "dead" in terms of no more development taking place. In addition to that i can't figure out how to cache a protected WMS with TIleCache (basic auth). ...