在MATLAB中在地图上绘制点

时间:2018-11-27 12:56:41

标签: matlab mapping

我尝试使用Plotting Points on a Map in MATLAB在matlab中的地图上绘制点,但是由于某些原因该点不会出现。 这是我的代码。

figure('visible','on');

    %%% Set the map boundaries
hi_lat=43.86;
lo_lat=41.23;
hi_lon= 6.08;
lo_lon=2.21;

    %%% Plot
worldmap ([lo_lat hi_lat], [lo_lon hi_lon]) % lat and lon bounds of your plot
geoshow('landareas.shp','FaceColor', 'green', 'EdgeColor', [0 0 0])
geoshow('worldcities.shp', 'Marker', '.',...
                       'Color', 'red')
labelLat = 43.5;
labelLon = 5.35;
textm(labelLat, labelLon, 'Marseille')
framem off; gridm off; mlabel off; plabel off
lat=3.13;
lon=42.48;
geoshow(lat,lon, 'DisplayType', 'Point', 'Marker', '+', 'Color', 'red'); %Part of the code that's not doing what I want it to do.

hold on

这使我得到下图: enter image description here

我该如何绘制另一点?为什么它不会出现?

2 个答案:

答案 0 :(得分:3)

您在地图上标记的点不会出现,因为您已经超过了纬度和经度限制。试试这个;

    <DataGrid x:Name="CodingCatalgoueFilteringDataGrid"
              Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="10"  MinWidth="400" 
              ItemsSource="{Binding CodedCatalogueList, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnTargetUpdated=True}" 
              SelectionMode="Extended"
              ToolTip="{Binding SelectedItem.Synonym, RelativeSource={RelativeSource Self}}"   
              RowDetailsTemplate="{StaticResource CodingCatalogueRowDetailsTemplate}"
              RowHeaderWidth="0"
              EnableColumnVirtualization="True" 
              EnableRowVirtualization="True" 
              VirtualizingPanel.IsVirtualizingWhenGrouping="True"
        >
        <DataGrid.Columns>
            <DataGridTextColumn x:Name="SynonymColumn"
                                Binding="{Binding Synonym}" 
                                Header="offene Angabe" 
                                MinWidth="120"
                                Width="*" 
                                >
            </DataGridTextColumn>
        </DataGrid.Columns>
        <!--  Style for groups at top level.  -->
        <DataGrid.GroupStyle>
            <GroupStyle HidesIfEmpty="True" >
                <GroupStyle.ContainerStyle>
                    <Style TargetType="{x:Type GroupItem}">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate>
                                    <Expander BorderBrush="DarkBlue">
                                        <Expander.Header>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Text="{Binding Path=Items[0].SchemeLabel}" />
                                                <TextBlock Text=" Count: " FontWeight="Normal"/>
                                                <TextBlock Text="{Binding Path=Items.Count}" FontWeight="Normal" />
                                            </StackPanel>
                                        </Expander.Header>
                                        <ItemsPresenter />
                                    </Expander>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=CheckBoxGrouping, Path=IsChecked}" Value="False">
                                <Setter Property="Visibility" Value="Collapsed"></Setter>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </GroupStyle.ContainerStyle>
            </GroupStyle>
        </DataGrid.GroupStyle>
    </DataGrid>

现在工作! 结果如下: points.jpg

答案 1 :(得分:0)

代码中的错误在这里:

lat=3.13;
lon=42.48;

您刚刚混合了纬度和经度,因此其试图在地图上绘制一些较远的点。

尝试:

lat=42.48;
lon=3.13;
相关问题