Select to view content in your preferred language

Map center is not working

518
0
10-27-2022 03:22 AM
Labels (1)
LarsChristianØstgaard
Occasional Contributor

Hi

 

I have the same problem every time I try to display a map in Python. Im using Notebook inside CS code.

The map is drawn but the center is not where I specified it to be.

Also the defined polygon is not displayed dispite I wrote the code to display it.  

The map is displayed but not the polygon and the map center is wrong, se the attached image.

 

Can someone see if I did something wrong?

python map.center.png

 

 

#Import modules
from arcgis.gis import GIS
from arcgis.geocoding import geocode
from arcgis.geometry import lengths, areas_and_lengths, project
from arcgis.geometry import Point, Polyline, Polygon, Geometry
import pandas as pd

#Connect to GIS
gis = GIS('home')

#Create a Polygon object
polygon1 = Polygon({'spatialReference': {'latestWkid': 4326}, 
                'rings': [[[-97.06587202923951, 32.75656343500563], [-97.07033522518535, 32.75454232619796],
                           [-97.07179434702324, 32.75443405154119], [-97.073596791488, 32.75475887587208],
                           [-97.07501299810983, 32.75475887587208], [-97.07492716677937, 32.75616643554153],
                           [-97.07595713555828, 32.75602207118053], [-97.07115061698558, 32.75887321736912],
                           [-97.06930525730476, 32.75890930713694], [-97.06479914614289, 32.75739351976198],
                           [-97.06587202923951, 32.75656343500563]]]
                })
polygon1

#Display the Polygon on a map
map3 = gis.map('2201 E Road to Six Flags St, Arlington, TX 76011, United States')
map3.basemap = "topo"
map3.zoom = 16
map3.center = {'x': -97.05815464365813, 'y': 32.75494892021667, 
               "spatialReference" : {"wkid" : 4326}}

#Draw the map
map3

#Draw the Polygon on the map
map3.draw(polygon1)

 

 

0 Kudos
0 Replies