Ignore:
Timestamp:
2016-08-19T02:40:50+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13358 - GeoJSON no longer permits projections other than WGS84, see https://tools.ietf.org/html/rfc7946

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/GeoJSONWriter.java

    r10817 r10852  
    3232import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3333import org.openstreetmap.josm.gui.mappaint.ElemStyles;
     34import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    3435import org.openstreetmap.josm.tools.Pair;
    3536
    3637/**
    3738 * Writes OSM data as a GeoJSON string, using JSR 353: Java API for JSON Processing (JSON-P).
     39 * <p>
     40 * See <a href="https://tools.ietf.org/html/rfc7946">RFC7946: The GeoJSON Format</a>
    3841 */
    3942public class GeoJSONWriter {
     
    4649     * Constructs a new {@code GeoJSONWriter}.
    4750     * @param layer The OSM data layer to save
    48      * @param projection The projection to use for coordinates
     51     * @since 10852
    4952     */
    50     public GeoJSONWriter(OsmDataLayer layer, Projection projection) {
     53    public GeoJSONWriter(OsmDataLayer layer) {
    5154        this.layer = layer;
    52         this.projection = projection;
     55        this.projection = ProjectionPreference.wgs84.getProjection();
    5356    }
    5457
     
    7477            JsonObjectBuilder object = Json.createObjectBuilder()
    7578                    .add("type", "FeatureCollection")
    76                     .add("crs", Json.createObjectBuilder().add("type", "name").add(
    77                             "properties", Json.createObjectBuilder().add("name", projection.toCode())))
    7879                    .add("generator", "JOSM");
    7980            appendLayerBounds(layer.data, object);
Note: See TracChangeset for help on using the changeset viewer.