我有以下两个shapefile:
> summary(precincts1)
Object of class SpatialPolygonsDataFrame
Coordinates:
min max
x -74.25545 -73.70002
y 40.49613 40.91540
Precinct Shape_Leng Shape_Area
Min. : 1.00 Min. : 17083 Min. : 15286897
1st Qu.: 31.50 1st Qu.: 29900 1st Qu.: 37593804
Median : 64.50 Median : 46887 Median : 65891025
Mean : 62.57 Mean : 65720 Mean :111231564
3rd Qu.: 95.50 3rd Qu.: 76375 3rd Qu.:133644443
Max. :123.00 Max. :309518 Max. :781725787
和
> summary(bnd_nhd)
Object of class SpatialPolygonsDataFrame
Coordinates:
min max
x 871512.3 912850.5
y 982994.4 1070956.9
SHAPE_area SHAPE_len
Min. : 3173813 Min. : 7879
1st Qu.: 9687122 1st Qu.:13514
Median :14363449 Median :17044
Mean :19674314 Mean :19516
3rd Qu.:27161251 3rd Qu.:23821
Max. :68101106 Max. :49269
他们的坐标系不同。我可以用传单在地图上覆盖“precincts1”的形状,但我不能对“bnd_nhd”做同样的事情。我正在使用闪亮的,maptools和传单。如何转换shapefile或更改地图上的设置,以便我可以将地图叠加为“bnd_nhd”?
答案 0 :(得分:4)
这应该有效:
package org.busTracker.trackingService;
/*
* Class to wrap the response for the Receiver class.
*/
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
//To return status without route null.
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SDBeanPost {
public int status;
public int route;
public String direction;
public SDBeanPost() {
Receiver receiver = new Receiver();
direction = "";
status = 230;
}
public String toJson() {
ObjectMapper mapper = new ObjectMapper();
String json = null;
try {
json = mapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return json;
}
}