British National Grid Shapefile - convert to WGS84 Lat/Lon - mapping

I have a set of ESRI shapefiles which, I'm told, have been written using the British National Grid coordinate system. I need to convert these files to WGS84 lat/lons, for onward conversion to KML files. I'm having trouble doing this as follows:
If I open each of the original files in MapInfo Professional telling it that my file has a projection which is British National Grid then I can't see any geographic objects in the file; the map window is completely empty.
If I use MapInfo Professional's Universal Translator to convert the files to a WGS84 MapInfo TAB file then, just as before, the converted file won't display any geographic objects, the MapInfo window is empty.
Can I verify the coordinate system of these files? Am I missing anything here? Should I be able to convert the shapefiles in the way I'm expecting to be able to and view them using MapInfo Professional? Will another tool do a better job for me?
Thanks.
More Info:
My shapefile has coordinates which don't seem to translate to lat/lon properly and I'm now wondering if the coordinates aren't actually British National Grid. I'm seeing coordinates such as 383702523, 399081141 which appears to be approximately lat/lon 53.488182, -2.247153. Have you any idea what projection system my input file is in?

OS grid doesn't use WGS84 - it uses Airy 1936 (OSGB36) spheroid
So you need to go from OSgrid -> lat/lon then OSGB36->WGS84.
See http://www.ordnancesurvey.co.uk/oswebsite/gps/docs/convertingcoordinatesEN.pdf
To do OS grid to lat-lon see http://www.movable-type.co.uk/scripts/latlong-gridref.html
Then to go from OSGB36 -> WGS84 see http://www.movable-type.co.uk/scripts/latlong-convert-coords.html

http://gothos.info/2009/04/14/transform-projections-with-gdal-ogr/
ogr2ogr is a great tool for doing these sorts of conversions. You would run it with a command like
ogr2ogr -t_srs EPSG:4326 map_wgs84.shp map_original.shp
-t_srs is the option to transform co-ordinate systems. 4326 is the EPSG SRID for WGS84.

Related

What is the best options for tippecanoe to process line string features?

I have a GeoJSON file with a FeatureCollection (more than 300 000 features) of LineStrings. It is a road traffic records. I need to convert it to the MVT format using Tippecanoe. I'm trying to convert the GeoJSON with this params:
tippecanoe data.geojson -pf -pS -zg --detect-shared-borders -o data.mbtiles -f
Then I uploading it to Mapbox account as a tileset and use to render with Mapbox GL JS. And there is a problem - not all the features are visible. Moreover, if if will reconvert the GeoJSON file - then I will get a different result! So - what is the best options to use with tippecanoe to convert all the features (lineStrings) without oversimplification to use it with Mapbox GL JS?
P.S. One more thing which I noticed is that datasets uploaded with Mapbox Studio and then converted to tileset has some info like this: "This layer contains mostly LineStrings", but with my own tilesets converted with the tippecanoe I see a next message: "* No dominant geometry type*"
-ae will auto-increase the maxzoom if features are still being dropped at that zoom level. But when zoomed out it doesn't always look good depending on the type of features (e.g.: mising cadastre doesn't look good)...

What format is the coordinate of this geojson example

I have this geojson for bike paths and I can't seem to figure out what the coordinates represents. I was expecting longitude and latitude, but those doesn't seem to be it.
Here is an example:
"geometry":{
"type":"LineString",
"coordinates":[
[
305049.6192401955,
5061761.891977313
],
[
305038.71863293805,
5061778.694289856
]
]
}
The source of data can be found here : bike path data
Unfortunately, it is only in french, but the data is under geojson section then click on "Explorer/Aller a la ressource"
Any help is appreciated,
Cheers,
Your data uses this spatial reference system: EPSG:2950, also known as: "NAD83(CSRS) / MTM zone 8". The units in this system is meters.
This information can be found at the top of your geojson file here:
"name": "urn:ogc:def:crs:EPSG::2950"
The crs stands for coordinate reference system (And for the trivia value, EPSG stands for "European Petroleum Survey Group").
This is likely confirmed by the shapefile from the same data source (based on your link), the .prj file states:
PROJCS["Ontario_MTM_Zone_8_east_of_75_degrees_W_NAD_83_datum"
The MTM refers to Modified Transverse Mercator. If you want to easily convert this data (unproject it essentially) to WGS84 to get longitude latitude pairs, you could download the shapefile, unzip it, and add all files to mapshaper.org, open the console and enter proj wgs84 and then export as a geosjon (or topojson).

What kind of coordinates are these numbers?

I have geo data, that contain X field like: 1012532,749 and Y field like: 178774,7655. This data from the shapefile format, but I don`t know in what GEO standart this data is.
Maybe someone know, or can show me the way to find out, how translate this coords in GPS.
From your comment the situation is clear:
You got an invalid shape file:
The prj file states WGS84 coordinates in decimal degrees
which has range: (longitude(x) [-180-.0, 180.0], latitude(y): [-90.0, 90.0].
But the coordinates posted are not in valid range.
The prj definition does not fit to the rest of the shape files (your posted coordinate).
(This happens because the prj file is optional, and has probably the default settings of some other project)
There is little chance of knowing, without further knowlegde.
Simply ask the data provider which geographical datum (name) the coordinates are related to. Further you should claim, that the file is erorrnous and that they should provide a correct prj file (or remove the prj file, if the coordinates are not related to world coordinates)
IF you know the source, e.g the swiss "Landesvermessung" then you could think it is for example a "Swiss Grid CH1903+ / LV95" grid system. (This was an example, the coordinates are not in that Swiss grid)
But it does not make sense to reverse engineer that, just ask the data provider, or if appliable read the info where you have got that data from.

Converting from Albers to GPS coordinates

I have some coordinate data and the only thing i know about its coordinate system is the
following description:
PROJCS["Basic Albers NAD83",
GEOGCS["GCS_North_American_1983",
DATUM["D_North_American_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]
],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]
],
PROJECTION["Albers"],
PARAMETER["False_Easting",0.0],
PARAMETER["False_Northing",0.0],
PARAMETER["Central_Meridian",-96.0],
PARAMETER["Standard_Parallel_1",45.5],
PARAMETER["Standard_Parallel_2",29.5],
PARAMETER["Latitude_Of_Origin",23.0],
UNIT["Foot_US",0.3048006096012192]
]
this comes from a prj arcGis file.
I need to convert from this system to GPS (Google maps) system and vice-versa.
this must be done programatically and i cannot use esri libraries (license issues)...
Could you explain the meaning of all these parameters?
are the coordinates expressed in the spheroid and the projection (albers) used only when drawing
the map? or the coordinates depend on the projection used also?
Do you know an open source library I could use for this transformation?
Thanks!
All these parameters define the projection, including:
Projection type (Albers)
GEOGCS defines the geoid (idealized Earth shape) used by the project. In this case, it's NAD83, which uses degrees for units and is centered at the Greenwich, the 0th longitude.
Where the projection itself is centered
How far the projection is moved north and east to make any negative coordinates
positive (False Easting and False Northing)
Units for coordinates in this projection (US Feet)
Some other information about how coordinates of the projection were transformed to be drawn on a flat service.
I have a blog post which goes over the details for an OGC WKT definition, which is very similar to the content in an ESRI .prj file: http://www.dev-garden.org/2011/07/30/projections-for-programmers-one-projection/. You may find it useful.
With projected coordinates, they have already been 'drawn on the map', and you need to reproject them to use in other coordinate systems like Google's projection.
There are many open source tools you can use to reproject your coordinates from one projected system to another. Here are a few:
Geotools or Proj4j - Java
Proj4js - Javascript
Proj - C or C++
dotspatial - C#
One command line tool I find very useful is ogr2ogr. Using ogr2ogr, it is very easy to reproject coordinates from one system to another. Here's how to convert a projected shapefile to a Google Earth projection:
ogr2ogr -f "ESRI Shapefile" -t_srs EPSG:3857 NEWFILE.shp OLDFILE.shp
Ogr2ogr uses the .prj file to determine the current projection of the shapefile, and then reprojects it to Googles projection, defined here by the EPSG shorthand EPSG:3857. You can find ogr2ogr for Windows and other platforms at http://fwtools.maptools.org/

How can I transform the coordinates of a Shapefile?

I am trying to get neighborhood data into my application, and I'm having problems with the data I am using, which I got from here.
This file contains a shapefile that has the neighborhoods of San Francisco. I am running a Ruby on Rails framework, and I'm currently using GeoRuby to parse the shapefile.
The code looks like this:
def self.run_import
shpfile = '/path/to/realtor_neighborhoods/realtor_neighborhoods'
ShpFile.open(shpfile) do |shp|
shp.each do |shape|
# This gets the first (and only) Polygon from each MultiPolygon
polygon = shape.geometry.geometries.first
puts polygon.inspect
end
end
end
The code is able to parse the file, but I am unable to understand the coordinates as interpreted. All of the points have values in the millions, when I would expect coordinates between -180 and 180, for valid latitude and longitude. Take a look at an example point:
<GeoRuby::SimpleFeatures::Point:0x00000104566a08 #srid=4326, #with_z=false, \
#with_m=false, #x=6015402.9999795845, #y=2114960.4999904726, #z=0.0, #m=0.0>,
What is the format of these coordinate values? How can I convert them to values that are meaningful to me? (i.e. latitude/longitude based on the SRID 4326 <=> WGS84 spatial reference system)
Thank you in advance!
The data you have from the shape file is projected geographic data.
From your question it sounds like you would really just prefer to have your data in lat/long. To get that you need to reproject your data. I am not a ruby guy, but a quick web search reveals that georuby does not support reprojection http://georuby.rubyforge.org/, however rgeo does. http://www.daniel-azuma.com/blog/archives/28
If you would like to know more about map projections have a look here.
By the way there is a stackexchange site for GIS (geographic information systems) experts called http://gis.stackexchange.com
I noticed this is still getting a log of views. I ended up struggling with RGeo, but there's another solution. If you are able/willing to do your conversion outside/before you execute your ruby code, check out ogr2ogr.
There are more details in my comment on the bottom here:
How Can I Use (Ruby) RGeo to Transform (Unproject) Coordinates
I came across this question as I wanted to transform points supplied in a Shapefile from OSGB36 British National Grid format to WGS84 format (decimal degrees). I spent a lot of time figuring this out so hopefully this code will prove useful.
This code uses the ffi-ogr gem and requires the GDAL library:
require 'ffi-ogr'
data = OGR.read file_name
new_spatial_ref = OGR.import_sr(4326, 'epsg')
data.layers.each do |layer|
transformer = OGR::CoordinateTransformation.find_transformation(layer.spatial_ref, new_spatial_ref)
layer.features.each do |feature|
geometry = OGR::Tools.cast_geometry(feature.geometry)
geometry.transform(transformer)
# Do something with geometry here
end
end
I had the same problem: wanted to convert projected geodata to Lat/Long values.
The ogr2ogr tool was much easier to use than I expected.
To install:
apt-get install gdal-bin
Get info about your shapefile:
ogrinfo data.shp -al -so
Convert to Lat/Long and JSON:
ogr2ogr -f GeoJSON -t_srs WGS84 data.json data.shp

Resources