missioncommand / mil-sym-java

(RETIRED) MIL-STD-2525 B and C rendering library and web service
Apache License 2.0
67 stars 36 forks source link

NFA Circular GeoJSON #92

Closed mg629 closed 6 years ago

mg629 commented 6 years ago

I am receiving an invalid GeoJSON structure on the response when I request single point with a radius for the symbol GFFPACNC------X, what am I doing wrong?

http://ipaddress:8080/mil-sym-service/renderer/mp2d/GFFPACNC------X? ID=NFA27&NAME=NFA27&DESCRIPTION=GFFPACNC------X&SYMBOLID=GFFPACNC------X&CONTROLPOINTS=-96,46%2C30.67&PIXELWIDTH=1024&PIXELHEIGHT=1024&BBOX=-96.46,30.68, -96.46,30.67&MODIFIERS={"AM":[20000]}&FORMAT=2&SYMSTD=1

Response: {"type":"FeatureCollection", "features":[ , {"type":"Feature","properties............. There seems to be an extra comma in the features section

Preview: {type: "FeaturesCollection", features: [null, {type: "Feature",...}]...} features: [null, {type: "Feature",...

michael-spinelli commented 6 years ago

I'll take a look

michael-spinelli commented 6 years ago

I think your bbox and coordinates are bad. you have: BBOX=-96.46,30.68, -96.46,30.67 (string "lowerLeftX,lowerLeftY,upperRightX,upperRightY." ) Your left and right x are the same value making the width zero.

Also, you had a comma in your coordinate string where I think you wanted a period.

Try these values: CONTROLPOINTS=-96.46,30.67 BBOX="-96.50,30.62,-96.40,30.72" MODIFIERS={"AM":[2000]}

Then go here to test your results: geojson.io

mg629 commented 6 years ago

Thank you. If I use the bounding box you described above, I do get valid values back unfortunately what I get back is a rectangular NFA. They want a circular NFA using the control point (as center point) and the radius (AM value of 20000). What do I need to send as modifiers value to get a circular NFA with a radius of 20000?

michael-spinelli commented 6 years ago

So the pixel width and height values are supposed to represent the width and height of the 2D map window on your screen. The bbox ideally represents the geographic bounds of the area shown in that map window. If either changes, you should make a call to the renderer to redraw the symbol. Your circle looks like a rectangle because it is being cropped by the bounds as to not spend time drawing lines outside of the visible area. For some systems that has been hard to implement so they just make the bbox a little bigger than the symbol itself using the coordinates of the symbol, which generally works too. However you can't do that when you have a symbol with 1 point that uses a distance value to determine how large the symbol is. You'd need to calculate your bbox using your symbol center point and the distance to get your west, south, east and north values of the bounding box for that symbol.

michael-spinelli commented 6 years ago

If you want to use your original values, I changed the bbox to "-97.46,29.67, -95.46,31.67". I just went a whole degree in every direction from the control point. That left enough room for your 20,000m radius. To do this on the fly in your application you'll have to do the math. Or maybe the map you're using has a function to get you an endpoint given a starting point, bearing and distance.

mg629 commented 6 years ago

Thank you. Now I understand what it requires. I was able to create correct bbox, and now the NFA displays correctly.