question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@arcgis/core: unable to set basemap center

See original GitHub issue

@arcgis/core version 4.21.2

I was able to bring the esm-samples\jsapi-angular-cli project into my own angular project to display the map in a component.

I changed the “portalItem” base layer for the WebMap object to basemap: 'hybrid', but it appears that all of the other common attributes are gone for web map, e.g. center, zoom etc. There doesn’t seem to have anyway to set its center either after instantiation.

I tried to use Map object, but it doesn’t have the .when() event handler.

Actually, is there a more significant example program using @arcgis/core beyond this simple map display? I mean that include loading layers, display attribute tables, select features, generate features etc.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
benelancommented, Nov 17, 2021

Although in the screenshot above it does look centered on San Francisco which is [-122.260544024, 37.81939394]. Maybe you’re looking for the zoom property?

1reaction
andygupcommented, Nov 16, 2021

Hi @t-zhai have you been able to solve the first issue that you reported above? As @odoe mentioned, can you provide a simple/minimal github repository that demos your basic app?

With regards to the buttons being out of place, it’s possible the CSS isn’t set, take a look at how we set it in our sample: https://github.com/Esri/jsapi-resources/blob/master/esm-samples/jsapi-angular-cli/src/app/app.component.css.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error while loading loading map. - Page 2 - Esri Community
Basemap ] #load() Failed to load basemap (title: 'Basemap', id: 'gray-vector') TypeError: t is not a constructor Zoom.js:5 Uncaught (in ...
Read more >
MapView | API Reference | ArcGIS Maps SDK for JavaScript ...
Programmatic navigation. You can set the initial extent (or visible portion of the map) by using either a combination of center and scale...
Read more >
Restricting base map on specific extent in ArcGIS API for ...
I have set the US extent code in my application but when I zoom out then I can see the whole world map...
Read more >
@arcgis/core - npm
ArcGIS API for JavaScript: A complete 2D and 3D mapping and data visualization API. Latest version: 4.25.5, last published: a month ago.
Read more >
Esri/esri-loader: A tiny library to help load ArcGIS API ... - GitHub
then(([Map]) => { // create map with the given options at a DOM node w/ id 'mapNode' let map = new Map('mapNode', {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found