-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from gis-tools/develop
Develop
- Loading branch information
Showing
8 changed files
with
76 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,50 @@ | ||
import React, {Component} from 'react'; | ||
import * as esriLoader from 'esri-loader'; | ||
import esriLoader from 'esri-loader'; | ||
import './App.css'; | ||
|
||
class App extends Component { | ||
const options = { | ||
url: 'https://js.arcgis.com/4.5' | ||
}; | ||
|
||
export default class App extends Component { | ||
constructor() { | ||
super(); | ||
|
||
if (!esriLoader.isLoaded()) { | ||
esriLoader.bootstrap((err) => { | ||
if (err) { | ||
console.error(err); | ||
} else { | ||
this.createMap(); | ||
} | ||
}, { | ||
// url: 'https://js.arcgis.com/4.4/' // Here you can change API version | ||
}); | ||
} else { | ||
this.createMap(); | ||
} | ||
|
||
this.state = { | ||
map: null, | ||
view: null | ||
} | ||
} | ||
esriLoader.loadModules([ | ||
'esri/Map', | ||
'esri/views/MapView' | ||
], options) | ||
.then(([Map, MapView]) => { | ||
let map = new Map({ | ||
basemap: "gray-vector" | ||
}); | ||
|
||
createMap = () => { | ||
esriLoader.dojoRequire([ | ||
"esri/Map", | ||
"esri/views/MapView" | ||
], (Map, MapView) => { | ||
let map = new Map({ | ||
basemap: "gray-vector" | ||
}); | ||
window.map = map; | ||
let view = new MapView({ | ||
map: map, | ||
container: "mapContainer", | ||
basemap: 'gray-vector', | ||
center: [-100, 30], | ||
zoom: 3 | ||
}); | ||
let view = new MapView({ | ||
map: map, | ||
container: "mapContainer", | ||
basemap: 'gray-vector', | ||
center: [-100, 30], | ||
zoom: 5 | ||
}); | ||
|
||
this.setState({ | ||
map, | ||
view | ||
}) | ||
}); | ||
}; | ||
this.setState({ | ||
map, | ||
view | ||
}) | ||
}) | ||
.catch(err => { | ||
console.error(err); | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className="App"> | ||
<div className="App-header"> | ||
<h1>Welcome to ESRI React App</h1> | ||
</div> | ||
<div id="mapContainer" /> | ||
<div id="mapContainer"/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default App; |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters