I have a set of Geo coordinate points with lat/lon values . I have plotted the points on a map. I want to connect the points by lines. I have tried the Points to Line tool in GIS but it just creates a polygon. I want to draw lines between the from(lon/lat) and to(lon/lat) coordinate points in this data set. Is there a simple way to do it? Here is some sample data.
From_Lon From_Lat To_Lon To_Lat
80.869178 16.357785 78.404167 17.383333
80.159683 12.981479 80.096817 12.992996
80.159412 12.981387 80.159422 12.981405
80.224847 12.975094 78.509808 17.441822
80.27 13.0839 78.509583 17.441693
78.4346 17.5088 80.203153 13.130134
80.201632 13.128197 80.201642 13.128202
80.201661 13.128212 80.037924 12.819227
80.021806 12.783412 80.168016 12.92074
Related
I want to use long/lat (EPSG:4326) coordinates in a bokeh plot and have a map in the Background.
I tried with the tile provider maps as suggested in bokeh: Mapping geo data.
But the format is in web mercator coordinates (EPSG:3857) and I don't want to convert my coordinates.
The general question how to do this is unanswered in Is it possible to set figure axis_type in bokeh to geographical (long/lat)?
My idea was to use extra axes:
from bokeh.plotting import figure, show
from bokeh.models import Range1d, LinearAxis
from bokeh.tile_providers import CARTODBPOSITRON, get_provider
tile_provider = get_provider(CARTODBPOSITRON)
p = figure(x_range=(-180, 180), y_range=(-90, 90)) # EPSG:4326
# add extra axis
p.extra_x_ranges = {"EPSG:3857x": Range1d(start=-20026376.39, end=20026376.39)}
p.extra_y_ranges = {"EPSG:3857y": Range1d(start=-20048966.10, end=20048966.10)}
# place extra axis
p.add_layout(LinearAxis(x_range_name="EPSG:3857x"), 'above')
p.add_layout(LinearAxis(y_range_name="EPSG:3857y"), 'right')
p.add_tile(tile_provider, x_range_name="EPSG:3857x", y_range_name="EPSG:3857y")
show(p)
But the map is not visible.
Is there a way to use extra axis for a tile_provider?
If you are just asking about displaying lat/lng visually on the axes, then all you have to do is set the axis type to "mercator"
p = figure(x_range=(-2000000, 6000000), y_range=(-1000000, 7000000),
x_axis_type="mercator", y_axis_type="mercator")
This is demonstrated on the documentation page you linked.
If you are asking about using data that is in lan/lng coordinates to plot on a tile plot, then you will need to convert it to Web Mercator first. The underlying coordinate system for tiles is always Web Mercator.
If you are asking about something else, then your question is not clear (please update to clarify).
I have a set of polygon points that have the SpatialReferences.WebMercator property. I need to convert these points to SpatialReferences.Wgs84 before saving to a database. Ideally I would just keep the WebMercator setting, but the existing database is using the Wgs84 format.
I am using the GeometryEngine class, but I noticed that once I reload the polygon, it is off by some way. It is in a different location. How can I make sure this conversion is accurate?
MapPoint point = new MapPoint(lon, lat, SpatialReferences.WebMercator);
MapPoint convertedPoint = (MapPoint)GeometryEngine.Project(point, SpatialReferences.Wgs84);
So as an example, I just drew a polygon with points -33.9360095288856 18,391141081041, -33,9075206517435 18,390454436898, -33,9303125156119 18,423413355855
After performing the conversion, the points became -36.1141869553583 18.0832273300021, -36.0798547481093 18.0825746003061, -36.1073205139085 18.113902885547
I am drawing one line from Location A to Location B using React.JS with Open Layers. I wish to get the Latitude and Longitude of the Location A and Location B.
I have added one listener after draw completion. But it is giving the co-ordinates as below . How can I get the latitude and longitude?
Listener:
draw.on('drawend',function(e){
console.log("Co Ordinates :",e.feature.getGeometry())
//console.log("Co Ordinates :",e.feature.getGeometry().getExtent())
});
Console :
Extent and flat coordinates values are printed in console as below
extent_:(4) [8732987.679175382, 1920132.5190330548, 8735555.9637923, 1920254.817578509]
flatCoordinates:(4) [8732987.679175382, 1920132.5190330548, 8735555.9637923, 1920254.817578509]
If you are just looking for a way to convert the coordinates you can use ol.proj.transform(coordinate, source, destination)
Using this
ol.proj.transform([8732987.679175382, 1920132.5190330548], 'EPSG:3857', 'EPSG:4326')
Will give this as output
[78.44976308230713, 16.99405070970775]
Also note that you can use getFirstCoordinate and getLastCoordinate methods on the line feature to get the first and last coordinates.
OpenLayer is working on different location formats like EPSG: 3857, EPSG: 4285 etc.
There are some Transform/Projection api enter link description here
Use this api's and transfer your locations to your desired formats
I have spent dozens of hour trying to find is it possible to change projection with mapserver with no luck so far. My input format is EPSG 3067 and I need to convert it to EPSG 900913 for Google Map use.
In the MAP object add
PROJECTION "init=epsg:900913" END
this sets the output projection of the map. Then in t LAYER object add
PROJECTION "init=epsg:3067" END
this set the projection that the incoming data for the layer is already in.
You will also need to add the following line to your /usr/share/proj/epsg or the equivalent path if you are on Windows:
Spherical Mercator projection
<900913> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +over +nadgrids=#null +no_defs <>
I have a table containing a map. The data looks like this
select
location.ToString()
from
mp_ices_areas
where
ICES_AREA in ('IIIa', 'IVa', 'IVb')
results in this:
POLYGON ((11.45850012 58.98790008, 11.4651 58.98660003, ...
POLYGON ((7.00000056 58.05548352, 7.00010064 58.05550053, ...
etc.
The map have been updated, so the "step looking" border is now a straight line. This is visualized using this query:
DECLARE #g1 geography = 'LINESTRING (7.0480147 57.982986, 8.598667 57.112833)';
select
location.STUnion(#g1)
from
mp_ices_areas
where
ICES_AREA in ('IIIa', 'IVa', 'IVb')
Original map with new border line
The result should be like this:
Corrected map
What needs to be done:
If you look at the first picture then the border beween the three areas (blue, purple and orange) looks like a staircase.
The areas needs to be changed so that this border between these three areas follows the thin red line instead (I tried to visualize the wanted result in the last picture).
I have coordinates of the red line (start and end point), so it must be possible somehow to make some SQL that could either update the geography object or help me manually create a new WKT string.