range different longitude and latitude geoshow

4 vues (au cours des 30 derniers jours)
muhammad iqbal habibie
muhammad iqbal habibie le 6 Avr 2020
Commenté : darova le 8 Avr 2020
I have longitude 112 to 114 and latitude -6.8 to -7.4.I am trying to range the longitude and latitude from geoshow, but somehow it doesnt change much
close all ;
clear;
data1 = shaperead ( 'data.shp' ); % polygon data
geoshow (data1)
u = shaperead ( 'points.shp' , 'UseGeoCoords' , true) % point data of 3050x1
h = geoshow (u, 'Marker' , 'o' , ...
'MarkerEdgeColor' , 'g' , ...
'MarkerSize' , 6)
legend ([h], 0.5, 'ok' );
so data1 is the shapefile of polygon and u are the point location.I wanted to make the longitude and latitude is range by 0.5 or 1 in geoshow? Inside file u it contains Geometry = 'point', Lon (Longitude) and Lat (Latitude ).
I try to edit in legend but it shows:
Error using legend> process_inputs (line 554)
Invalid argument.Type 'help legend' for more information.
  1 commentaire
darova
darova le 6 Avr 2020
Please attacht the data. Can you make a simple drawing of what you are trying todo? The qustion is unclear

Connectez-vous pour commenter.

Réponses (3)

muhammad iqbal habibie
muhammad iqbal habibie le 7 Avr 2020
Modifié(e) : muhammad iqbal habibie le 7 Avr 2020
As you seen from my attachment the differences of each longitude on the x axes and latitude on the y axes is not same. I would like to make it range 0.5 examples for longitude starts 112 then 112.5,then 113. and also latitude start from -6.8 then -6.85 then -6.9. I try above to edit from the legend but it has an error. Beside the range 0.5 maybe can modified the range to other 0.01. Hopefully it is possible. Because when I read the shapefile from data1 it direct show,maybe can possible to change the range of longitude and latitude.

darova
darova le 7 Avr 2020
Here is my idea
Use meshgrid to create a grid (red points)
Use inpolygon to choose points inside map (blue circles)
  2 commentaires
muhammad iqbal habibie
muhammad iqbal habibie le 8 Avr 2020
Thank you for your idea. This is good for creating the points. But I want to edit the range of the longitude or latitude either the differences is 0.5 or can be modified yourself. For examples from the picture shows the longitude 112 to 112.6 and the differences is 0.1 as well as the latitude, is it possible can modified the range beside automatically loading from the data shapefile?
darova
darova le 8 Avr 2020
try this
latstart = 112;
lonstart = -7.5;
step = 0.5;
newlat = round((lat-latstart)/step)*step + latstart;
newlon = round((lon-lontart)/step)*step + lonstart;
Some duplicate values may appear. You can remove them
[~,ix1] = unique(newlat);
[~,ix2] = unique(newlon);
ix = unique([ix1(:);ix2(:)]);
newlat = newlat(ix);
newlon = newlon(ix);

Connectez-vous pour commenter.


Sean de Wolski
Sean de Wolski le 7 Avr 2020
Look at bufferm https://www.mathworks.com/help/map/ref/bufferm.html. Call that on your data and then just take the bounds() of it.
  1 commentaire
muhammad iqbal habibie
muhammad iqbal habibie le 8 Avr 2020
Any examples to use if my longitude and latitude it belongs from the shapefile of data1 using bufferm? thank you

Connectez-vous pour commenter.

Tags

Produits


Version

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by