Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Zoom to layer extent #22

Open
slibby opened this issue May 5, 2017 · 6 comments
Open

Enhancement: Zoom to layer extent #22

slibby opened this issue May 5, 2017 · 6 comments
Labels

Comments

@slibby
Copy link
Collaborator

slibby commented May 5, 2017

When adding a layer, if the user is currently viewing an area outside the extent of the layer (rectangle A does not intersect rectangle B), the screen should pan to the area of data coverage and display the service extent as a rectangle on the map (kind of like how HOT handles this)

@slibby slibby changed the title Zoom to layer extent Enhancement: Zoom to layer extent May 5, 2017
@mapmeld
Copy link
Owner

mapmeld commented May 9, 2017

I looked at https://github.com/proj4js/proj4js for more info on how to convert a layer extent from a different projection. The City of Madison, Wisconsin provides wkid 103412 as their projection.

https://maps.cityofmadison.com/arcgis/rest/services/Public/OPEN_DATA_TRANS/MapServer/18/metadata?f=json

I don't see a way to implement this without finding a large set of defaults, a service to retrieve projection definitions, or allow user to write in the projection details

@slibby
Copy link
Collaborator Author

slibby commented Oct 3, 2017

@mapmeld I think this should happen after the layer list is loaded (/0 to /x) and the user selects a layer, but before they see the list of attributes (which often obscures the entire map). In most cases, I believe that the map should zoom to that extent to start, unless the user is at a smaller current map extent (more zoomed in) than that extent would move them to.

@jgravois
Copy link
Collaborator

jgravois commented Oct 3, 2017

10.3+ and ArcGIS Online query operations support returnExtentOnly to fetch the bounding box of an arbitrary selection (or the entire layer) in any projection.

// 20171003134925
// https://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/services/Heritage_Trees_Portland/FeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&returnExtentOnly=true&f=json

{
  "extent": {
    "xmin": -122.74906513128271,
    "ymin": 45.435197255383585,
    "xmax": -122.50384940834815,
    "ymax": 45.593128938067593,
    "spatialReference": {
      "wkid": 4326,
      "latestWkid": 4326
    }
  }
}

as such, i think it'd be just fine to only offer a 'zoom to layer' feature for modern services.

@mapmeld
Copy link
Owner

mapmeld commented Oct 4, 2017

I do get the extent returned with the initial metadata, I just can't control what projection comes back. I am thinking that this feature is possible to add and then only keep enabled for services with a common spatial reference

Something else to keep in mind: zoom to extent will be useful but unlikely to be perfect - a citywide service shouldn't be imported in one go like this, we expect people to zoom in. But it does help with initial setup / figuring out why things aren't working

@slibby
Copy link
Collaborator Author

slibby commented Oct 4, 2017

Another option would be to have some means of "minimizing" the attribute-picker page so that you can see the map behind it, right now once you add a service URL, you can no longer zoom to a different area to reduce the number of features in the current extent without closing the attribute display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants