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

clipmap_bounds incorrectly set to map bounds not clip bounds #94

Closed
lklepner opened this issue May 6, 2016 · 5 comments
Closed

clipmap_bounds incorrectly set to map bounds not clip bounds #94

lklepner opened this issue May 6, 2016 · 5 comments

Comments

@lklepner
Copy link

lklepner commented May 6, 2016

I've noticed that the bounds of the Preview window, which are determined by the clipmap_bounds_merc value, seem to be the bounds of the raw map, not the clipped map, causing zoomToMaxExtent to be offcenter and too wide (framing for the uncropped map).

Originally reported here - nypl-spacetime/nypl-warper#45

@timwaters
Copy link
Owner

👍 many thanks!

@timwaters
Copy link
Owner

given a clipped mask like this: screenshot_2019-02-27_16-10-28

instead of showing this in the preview

screenshot_2019-02-27_16-10-59

it should show this:

screenshot_2019-02-27_16-11-29

@timwaters
Copy link
Owner

So we need to get the bounds of the clip. The clip mask is in image pixel space and not lat / lon - so we need to use the control points and warp this mask and then get the bounds from that.

@timwaters
Copy link
Owner

timwaters commented Feb 28, 2019

ogr2ogr -f 'geojson' -s_srs 'epsg:4326' -t_srs 'epsg:3857' -gcp 1014.7415730337, 387.3707865169, -4.8339843748, 27.3717672995 -gcp 2748.8539325843, 301.6179775281, 27.5097656239, 24.3671135617 -gcp 2086.6516853933, 1573.61797752809, 11.8652343745, 1.7575368112 /dev/stdout 40.gml

@timwaters
Copy link
Owner

`var vector = new OpenLayers.Layer.Vector("GeoJSON", {
projection: "EPSG:4326"
});
warpedmap.addLayer(vector);

var gformat = new OpenLayers.Format.GeoJSON();

var geojson = { "type": "FeatureCollection", "crs":
{ "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::3857" } }, "features": [ { "type": "Feature", "properties": { "gml_id": "OpenLayers.Feature.Vector_1062" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -1473251.146541122812778, 1750757.330724694067612 ], [ -565473.037400622386485, 1677228.57177498540841 ], [ 147463.154717215918936, 121651.659036649682093 ], [ 1644856.532875066390261, 1304113.145248382119462 ], [ 2281665.7328170100227, 1386434.738192284712568 ], [ 3311048.52826199959964, 1472702.619407647522166 ], [ 3015320.313555198255926, -674648.850655971094966 ], [ -2732571.129231195896864, 106772.551659110293258 ], [ -2484078.486649194266647, 1429663.375425678445026 ], [ -1473251.146541122812778, 1750757.330724694067612 ] ] ] } } ] };
var features = gformat.read(geojson)
vector.addFeatures(features);
`

timwaters added a commit that referenced this issue Mar 1, 2019
…into the preview map if the map has been cropped :emoji: refs #94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants