pepe
pepe

Reputation: 11

How to plot coordinates on a map object in Jupyter notebook?

I'm new to working with the ArcGIS library. I've looked over the ArcGIS 2.4.0 documentation but still confused on how to plot coordinates onto a base map.

I tried finding examples of implementing something similar but was unsuccessful.

So far, I've run this.

from arcgis.gis import GIS
from arcgis.map import Map
from shapely.geometry import Point

#alcatraz island
coordinateX = -122.4230
coordinateY = 37.8270

coordinate = Point(coordinateX, coordinateY)

gis = GIS() #hiding GIS credentials

map = gis.map('San Francisco')
map.content.add(coordinate)
map

Although the map of San Francisco displays, there is no point plotted on Alcatraz Island.

Upvotes: 1

Views: 50

Answers (1)

sandeman_13
sandeman_13

Reputation: 395

The MapContent class's .add() method is for layers, the .draw() method is for shapes.

Also, use the ArcGIS API for Python's Point class instead of shapely's (will set a default spatial reference for your point of WGS84, or you can set your own).

from arcgis.gis import GIS
from arcgis.map import Map
from arcgis.geometry import Point

gis = GIS()

coordinate = Point([-122.4230, 37.8270])

map = gis.map('San Francisco')
map.content.draw(coordinate)
map

I tried finding examples of implementing something similar but was unsuccessful.

Here's a good example.

Upvotes: 1

Related Questions