Related
I am trying to create a visualization from US county related data. When I use the json data set in online validators and tools the counties render fine. But when I try to render a basic map the screen comes up blank. The svg paths are appended to the svg and their d attribute value looks appropriate to me, here is an example path (corresponding to the first object in the features array in the below listed json):
<path d="M-85.388717,33.913044L-85.391495,33.927068L-85.398837,33.964129L-85.407637,33.964204L-85.407831,33.960548L-85.425444,33.960645L-85.425627,33.957069L-85.495289,33.95691L-85.49582,33.942394L-85.530094,33.941423L-85.531812,33.903049L-85.532482,33.889152L-85.597063,33.889703L-85.601858,33.88975L-85.601913,33.875101L-85.601899,33.874865L-85.637014,33.875944L-85.637012,33.875273L-85.637126,33.846497L-85.636882,33.846495L-85.585201,33.84592L-85.585985,33.802095L-85.603391,33.802344L-85.603465,33.788474L-85.603469,33.787755L-85.62089,33.787944L-85.621019,33.782331L-85.621245,33.773508L-85.638049,33.773339L-85.638586,33.649158L-85.638579,33.648413L-85.64704,33.648772L-85.64719,33.641529L-85.651283,33.64157L-85.651295,33.637972L-85.655549,33.638127L-85.65581,33.627166L-85.674932,33.627254L-85.690684,33.627789L-85.690716,33.625105L-85.69014,33.615815L-85.689954,33.612909L-85.723074,33.613505L-85.72365,33.613491L-85.72367,33.613492L-85.724953,33.613539L-85.724517,33.59943L-85.737379,33.599823L-85.742202,33.600002L-85.742348,33.586553L-85.744118,33.556075L-85.796054,33.55622L-85.796852,33.541849L-85.849839,33.49969L-85.85189,33.498742L-85.852421,33.491644L-85.869308,33.491574L-85.870053,33.476757L-85.887675,33.476768L-85.887782,33.469427L-85.782735,33.469349L-85.782689,33.483638L-85.781244,33.483625L-85.765631,33.483477L-85.765308,33.496862L-85.765427,33.498593L-85.740983,33.498376L-85.680346,33.496623L-85.66722,33.496293L-85.643482,33.495885L-85.627835,33.495624L-85.623645,33.495373L-85.623387,33.495371L-85.565653,33.494992L-85.563763,33.495081L-85.539922,33.494743L-85.527515,33.494608L-85.52513,33.494781L-85.51731,33.494524L-85.501645,33.494456L-85.497455,33.494624L-85.355315,33.49248L-85.352573,33.492438L-85.352576,33.494538L-85.354491,33.498866L-85.351594,33.4996L-85.349958,33.501216L-85.346705,33.501148L-85.344923,33.497608L-85.342544,33.495961L-85.33828,33.4947L-85.331061,33.491014L-85.324856,33.489161L-85.320893,33.488359L-85.316028,33.488267L-85.314852,33.487603L-85.30925,33.483137L-85.308211,33.481579L-85.304439,33.482884L-85.313999,33.529807L-85.314091,33.530218L-85.314843,33.534951L-85.314994,33.535898L-85.31534,33.537646L-85.323792,33.580339L-85.342722,33.675953L-85.344054,33.682684L-85.355252,33.739245L-85.357402,33.750104L-85.360491,33.767958L-85.361844,33.773951L-85.364595,33.788446L-85.376403,33.850656L-85.377426,33.856047L-85.379455,33.866291L-85.380885,33.873508Z"></path>
But, visually there is nothing. I checked adding fill and stroke values, with no results. I also tried scaling the paths up to see if they were rendering too small, the size increased, and the browser dev tools showed a large size, but visually we still have a blank area.
Here is the code I am using to try and produce the map:
./corrected.json
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { "GEO_ID": "0500000US01029", "STATE": "01", "COUNTY": "029", "NAME": "Cleburne", "LSAD": "County", "CENSUSAREA": 560.100000 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -85.388717, 33.913044 ], [ -85.380885, 33.873508 ], [ -85.379455, 33.866291 ], [ -85.377426, 33.856047 ], [ -85.376403, 33.850656 ], [ -85.364595, 33.788446 ], [ -85.361844, 33.773951 ], [ -85.360491, 33.767958 ], [ -85.357402, 33.750104 ], [ -85.355252, 33.739245 ], [ -85.344054, 33.682684 ], [ -85.342722, 33.675953 ], [ -85.323792, 33.580339 ], [ -85.315340, 33.537646 ], [ -85.314994, 33.535898 ], [ -85.314843, 33.534951 ], [ -85.314091, 33.530218 ], [ -85.313999, 33.529807 ], [ -85.304439, 33.482884 ], [ -85.308211, 33.481579 ], [ -85.309250, 33.483137 ], [ -85.314852, 33.487603 ], [ -85.316028, 33.488267 ], [ -85.320893, 33.488359 ], [ -85.324856, 33.489161 ], [ -85.331061, 33.491014 ], [ -85.338280, 33.494700 ], [ -85.342544, 33.495961 ], [ -85.344923, 33.497608 ], [ -85.346705, 33.501148 ], [ -85.349958, 33.501216 ], [ -85.351594, 33.499600 ], [ -85.354491, 33.498866 ], [ -85.352576, 33.494538 ], [ -85.352573, 33.492438 ], [ -85.355315, 33.492480 ], [ -85.497455, 33.494624 ], [ -85.501645, 33.494456 ], [ -85.517310, 33.494524 ], [ -85.525130, 33.494781 ], [ -85.527515, 33.494608 ], [ -85.539922, 33.494743 ], [ -85.563763, 33.495081 ], [ -85.565653, 33.494992 ], [ -85.623387, 33.495371 ], [ -85.623645, 33.495373 ], [ -85.627835, 33.495624 ], [ -85.643482, 33.495885 ], [ -85.667220, 33.496293 ], [ -85.680346, 33.496623 ], [ -85.740983, 33.498376 ], [ -85.765427, 33.498593 ], [ -85.765308, 33.496862 ], [ -85.765631, 33.483477 ], [ -85.781244, 33.483625 ], [ -85.782689, 33.483638 ], [ -85.782735, 33.469349 ], [ -85.887782, 33.469427 ], [ -85.887675, 33.476768 ], [ -85.870053, 33.476757 ], [ -85.869308, 33.491574 ], [ -85.852421, 33.491644 ], [ -85.851890, 33.498742 ], [ -85.849839, 33.499690 ], [ -85.796852, 33.541849 ], [ -85.796054, 33.556220 ], [ -85.744118, 33.556075 ], [ -85.742348, 33.586553 ], [ -85.742202, 33.600002 ], [ -85.737379, 33.599823 ], [ -85.724517, 33.599430 ], [ -85.724953, 33.613539 ], [ -85.723670, 33.613492 ], [ -85.723650, 33.613491 ], [ -85.723074, 33.613505 ], [ -85.689954, 33.612909 ], [ -85.690140, 33.615815 ], [ -85.690716, 33.625105 ], [ -85.690684, 33.627789 ], [ -85.674932, 33.627254 ], [ -85.655810, 33.627166 ], [ -85.655549, 33.638127 ], [ -85.651295, 33.637972 ], [ -85.651283, 33.641570 ], [ -85.647190, 33.641529 ], [ -85.647040, 33.648772 ], [ -85.638579, 33.648413 ], [ -85.638586, 33.649158 ], [ -85.638049, 33.773339 ], [ -85.621245, 33.773508 ], [ -85.621019, 33.782331 ], [ -85.620890, 33.787944 ], [ -85.603469, 33.787755 ], [ -85.603465, 33.788474 ], [ -85.603391, 33.802344 ], [ -85.585985, 33.802095 ], [ -85.585201, 33.845920 ], [ -85.636882, 33.846495 ], [ -85.637126, 33.846497 ], [ -85.637012, 33.875273 ], [ -85.637014, 33.875944 ], [ -85.601899, 33.874865 ], [ -85.601913, 33.875101 ], [ -85.601858, 33.889750 ], [ -85.597063, 33.889703 ], [ -85.532482, 33.889152 ], [ -85.531812, 33.903049 ], [ -85.530094, 33.941423 ], [ -85.495820, 33.942394 ], [ -85.495289, 33.956910 ], [ -85.425627, 33.957069 ], [ -85.425444, 33.960645 ], [ -85.407831, 33.960548 ], [ -85.407637, 33.964204 ], [ -85.398837, 33.964129 ], [ -85.391495, 33.927068 ], [ -85.388717, 33.913044 ] ] ] } }
,
{ "type": "Feature", "properties": { "GEO_ID": "0500000US01031", "STATE": "01", "COUNTY": "031", "NAME": "Coffee", "LSAD": "County", "CENSUSAREA": 678.972000 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -86.030441, 31.618939 ], [ -86.004085, 31.619067 ], [ -85.999948, 31.619311 ], [ -85.980098, 31.619189 ], [ -85.926702, 31.618966 ], [ -85.904460, 31.618775 ], [ -85.899202, 31.618729 ], [ -85.878888, 31.618547 ], [ -85.832214, 31.618240 ], [ -85.789142, 31.617964 ], [ -85.789141, 31.587866 ], [ -85.789140, 31.540617 ], [ -85.789308, 31.490925 ], [ -85.789370, 31.487561 ], [ -85.789372, 31.487430 ], [ -85.790294, 31.431467 ], [ -85.789837, 31.385469 ], [ -85.789815, 31.383145 ], [ -85.789594, 31.372698 ], [ -85.789754, 31.358887 ], [ -85.789785, 31.356562 ], [ -85.789866, 31.350574 ], [ -85.790001, 31.342857 ], [ -85.789975, 31.341524 ], [ -85.790064, 31.337277 ], [ -85.790065, 31.336908 ], [ -85.790100, 31.336276 ], [ -85.790116, 31.330082 ], [ -85.790327, 31.323452 ], [ -85.790434, 31.320267 ], [ -85.790525, 31.317495 ], [ -85.791089, 31.297603 ], [ -85.791167, 31.295340 ], [ -85.791243, 31.294184 ], [ -85.791245, 31.294004 ], [ -85.791214, 31.293551 ], [ -85.791218, 31.293252 ], [ -85.791361, 31.291777 ], [ -85.791312, 31.269325 ], [ -85.791291, 31.209854 ], [ -85.791402, 31.196349 ], [ -85.847766, 31.196369 ], [ -85.857352, 31.196367 ], [ -85.857999, 31.196374 ], [ -85.865347, 31.196374 ], [ -85.882227, 31.196339 ], [ -85.938287, 31.196344 ], [ -85.949386, 31.196123 ], [ -85.950142, 31.196242 ], [ -85.960322, 31.195962 ], [ -85.966110, 31.195935 ], [ -85.999042, 31.195777 ], [ -86.013060, 31.195318 ], [ -86.058535, 31.194082 ], [ -86.116734, 31.193015 ], [ -86.116735, 31.183885 ], [ -86.116736, 31.182099 ], [ -86.125405, 31.182057 ], [ -86.125482, 31.192754 ], [ -86.141674, 31.192693 ], [ -86.193476, 31.192213 ], [ -86.194003, 31.211362 ], [ -86.193542, 31.213028 ], [ -86.193846, 31.219589 ], [ -86.193714, 31.243119 ], [ -86.193336, 31.250169 ], [ -86.193546, 31.262915 ], [ -86.193888, 31.283526 ], [ -86.194631, 31.327933 ], [ -86.194779, 31.336812 ], [ -86.195044, 31.352681 ], [ -86.195056, 31.353359 ], [ -86.196091, 31.410348 ], [ -86.196365, 31.425431 ], [ -86.193951, 31.440072 ], [ -86.193973, 31.446586 ], [ -86.194724, 31.524460 ], [ -86.194784, 31.529949 ], [ -86.182098, 31.530047 ], [ -86.156561, 31.530203 ], [ -86.156768, 31.537527 ], [ -86.150314, 31.537601 ], [ -86.143950, 31.537675 ], [ -86.144761, 31.570994 ], [ -86.145895, 31.617741 ], [ -86.124952, 31.618044 ], [ -86.123834, 31.618167 ], [ -86.094925, 31.618405 ], [ -86.058021, 31.618793 ], [ -86.030441, 31.618939 ] ] ] } }
]
}
./maps.html
<html>
<div id="map-container"></div>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="https://unpkg.com/topojson#3"></script>
<script src="map.js"></script>
</html>
./map.js
let h = 500;
let w = 960;
path = d3.geoPath();
d3.select("#map-container")
.append("svg")
.attr("id", "map")
.attr("height", h)
.attr("width", w)
.attr("fill", "blue")
.append("title")
.text("Southeastern Region Counties")
.attr("id", "title");
let maplink = "./corrected.json";
Promise.all([d3.json(maplink)]).then(([data]) => {
let paths = d3.select("#map").selectAll("path").data(data.features);
paths.enter().append("path").attr('d', path);
});
I don't see any error message, and haven't located my error in the documentation. What am I missing?
Your coordinates are unprojected, a collection of latitude longitude pairs, but you are treating these coordinates as pixel coordinates. This shows with your resulting path data: M-85.388717,33.913044, a coordinate representing -85° E, 34° N. That the x value, longitude here, is negative means your map is rendered outside the SVG - to its left, hence why it is not visible.
You need to run your latitute longitute pairs through a geographic projection that takes those points on a 3D sphere and projects them to the 2D plane of your SVG. In doing so you'll introduce some degree of distortion, so you may want to try a few projections (though this is often minimal if zoomed in enough, say on a city).
If you do not provide a projection to d3.geoPath() it'll use a null projection which treats input coordinates as pixel coordinates. This won't let you simply shift the map to the right: geographic convention is that latitutes increase as one moves north (typically up on a map), whereas SVG/Canvas convention is that pixel y values increase as one moves down
For example to use an Albers projection you could use:
var projection = d3.geoAlbers();
var path = d3.geoPath().projection(projection);
This gets us half way there: the projection is independent of your features, we need to center and scale the projection appropriately. To do so, after we load the geojson, we can use:
projection.fitSize([width,height],data)
Where data is a geojson object (hence why we don't use data.features).
I'm having some trouble getting the signature tag to show on the correct location.
I have 2 separate signers with one document to sign. Each signer must sign one unique signature with separate label names.
private SignHere buildSignHere(Signature signature, String documentId) {
SignHere signHere = new SignHere();
signHere.setTabLabel(getSignatureLabel(signature));
signHere.setPageNumber(String.valueOf(signature.getSignatureLocationId().getPage().intValue() + 1));
signHere.setDocumentId(documentId);
return signHere;
}
I then simply create a Tabs and add the SignHere to the Tabs. Each signer has their own Tabs object. What ends up happening is that the signature location is at the top of the page, but in the original PDF, the signature location is defined in a different area.
So my question is - why does DocuSign not pick up the correct location based on the label name identified? Is there a way to configure this so that it automatically picks up the location from the label? The length/width and X/Y coordinates are already defined by the label within the PDF, so I'm confused as to why it doesn't pick that up, or does it need to be explicitly provided? I'm looking for a solution to pick up the coordinates automatically.
Please note, I have also tried turning on setTransformPdfFields("true") for the Document object. While this method does pick up the correct location, it does not produce the result I need because it allows both signature locations to be visible for both signers, which is incorrect. I need each signer to only see their own signature as identified in the SignHere object. So it seems there is a way to pick up the location automatically via the setTransformPdfFields(), but not by using the setTabLabel() within the SignHere object.
Here is the full json for the request I made.
{
"attachments":[
],
"compositeTemplates":[
],
"documents":[
{
"documentBase64":"JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9TdWJ0eXBlL0Zvcm0vRmlsdGVyL0ZsYXRlRGVjb2RlL1R5cGUvWE9iamVjdC9NYXRyaXggWzEgMCAwIDEgMCAwXS9Gb3JtVHlwZSAxL1Jlc291cmNlczw8L1Byb2NTZXQgWy9QREYgL1RleHQgL0ltYWdlQiAvSW1hZ2VDIC9JbWFnZUldL0ZvbnQ8PC9IZWx2IDIgMCBSPj4+Pi9CQm94WzAgMCAzMi40OCAxNC43NV0vTGVuZ3RoIDkzPj5zdHJlYW0KeJwdzMEKQEAUheFX+ZdshhkjtkZTNhZTtzwBSigW8vhuOptTX/0XiUJewthzUeoqZ3yL9aapuWcmToUg2F8tjsqUDXJQDPP+YB2yqKxkXchl+28U7SaiVj9MKRZKCmVuZHN0cmVhbQplbmRvYmoKMyAwIG9iago8PC9TdWJ0eXBlL0Zvcm0vRmlsdGVyL0ZsYXRlRGVjb2RlL1R5cGUvWE9iamVjdC9NYXRyaXggWzEgMCAwIDEgMCAwXS9Gb3JtVHlwZSAxL1Jlc291cmNlczw8L1Byb2NTZXQgWy9QREYgL1RleHQgL0ltYWdlQiAvSW1hZ2VDIC9JbWFnZUldL0ZvbnQ8PC9IZWx2IDIgMCBSPj4+Pi9CQm94WzAgMCAxMzkuMzIgMTQuNzVdL0xlbmd0aCAxMDQ+PnN0cmVhbQp4nCXNMQqEQBBE0av8UANHe8ZBTBVhEwOhwcRUhWUVNBCPv41SUMkL/sFArjdN33JQ2CTULnikdFXknBnZTRpFXsYTXFGhG/ln/l",
"documentFields":[
],
"documentId":"1",
"fileExtension":"pdf",
"matchBoxes":[
],
"name":"8943520714564164772_1597681120885.pdf",
"pageSizes":[
]
}
],
"emailSubject":"Nazir Noori has added you as a Signer.",
"envelopeAttachments":[
],
"envelopeDocuments":[
],
"eventNotifications":[
],
"folders":[
],
"recipients":{
"agents":[
],
"carbonCopies":[
],
"certifiedDeliveries":[
],
"editors":[
],
"inPersonSigners":[
],
"intermediaries":[
],
"seals":[
],
"signers":[
{
"customFields":[
],
"documentVisibility":[
],
"email":"nazir.noori44#gmail.com",
"excludedDocuments":[
],
"firstName":"Nazir",
"lastName":"Noori",
"name":"Nazir Noori",
"recipientAttachments":[
],
"recipientFeatureMetadata":[
],
"recipientId":"1",
"recipientSignatureProviders":[
],
"roleName":"signer",
"routingOrder":"1",
"signingGroupUsers":[
],
"socialAuthentications":[
],
"tabs":{
"approveTabs":[
],
"checkboxTabs":[
],
"commentThreadTabs":[
],
"companyTabs":[
],
"dateSignedTabs":[
],
"dateTabs":[
],
"declineTabs":[
],
"emailAddressTabs":[
],
"emailTabs":[
],
"envelopeIdTabs":[
],
"firstNameTabs":[
],
"formulaTabs":[
],
"fullNameTabs":[
],
"initialHereTabs":[
],
"lastNameTabs":[
],
"listTabs":[
],
"notarizeTabs":[
],
"noteTabs":[
],
"numberTabs":[
],
"polyLineOverlayTabs":[
],
"radioGroupTabs":[
],
"signerAttachmentTabs":[
],
"signHereTabs":[
{
"documentId":"1",
"pageNumber":"2",
"tabGroupLabels":[
],
"tabLabel":"_.signaturePanel[SIGNATURE][1].signatory[ADVISOR][1]"
}
],
"smartSectionTabs":[
],
"ssnTabs":[
],
"tabGroups":[
],
"textTabs":[
],
"titleTabs":[
],
"viewTabs":[
],
"zipTabs":[
]
}
},
{
"customFields":[
],
"documentVisibility":[
],
"email":"nathan.sypes44#gmail.com",
"excludedDocuments":[
],
"firstName":"Nathan",
"idCheckConfigurationName":"SMS Auth $",
"lastName":"Sypes",
"name":"Nathan Sypes",
"recipientAttachments":[
],
"recipientFeatureMetadata":[
],
"recipientId":"2",
"recipientSignatureProviders":[
],
"roleName":"signer",
"routingOrder":"2",
"signingGroupUsers":[
],
"smsAuthentication":{
"senderProvidedNumbers":[
"4168564209"
]
},
"socialAuthentications":[
],
"tabs":{
"approveTabs":[
],
"checkboxTabs":[
],
"commentThreadTabs":[
],
"companyTabs":[
],
"dateSignedTabs":[
],
"dateTabs":[
],
"declineTabs":[
],
"emailAddressTabs":[
],
"emailTabs":[
],
"envelopeIdTabs":[
],
"firstNameTabs":[
],
"formulaTabs":[
],
"fullNameTabs":[
],
"initialHereTabs":[
],
"lastNameTabs":[
],
"listTabs":[
],
"notarizeTabs":[
],
"noteTabs":[
],
"numberTabs":[
],
"polyLineOverlayTabs":[
],
"radioGroupTabs":[
],
"signerAttachmentTabs":[
],
"signHereTabs":[
{
"documentId":"1",
"pageNumber":"2",
"tabGroupLabels":[
],
"tabLabel":"_.signaturePanel[SIGNATURE][1].signatory[INVESTOR][1]"
}
],
"smartSectionTabs":[
],
"ssnTabs":[
],
"tabGroups":[
],
"textTabs":[
],
"titleTabs":[
],
"viewTabs":[
],
"zipTabs":[
]
}
}
],
"witnesses":[
]
},
"status":"sent",
"templateRoles":[
]
}
Would appreciate any insight into this. Thanks.
Have you tried adding for example "xPosition": "100","yPosition":"100" to signHereTabs
as per this guide https://developers.docusign.com/esign-rest-api/guides/concepts/tabs
i try to import a geojson file to mariadb but without success.
i have install "grimzy/laravel-mysql-spatial": "^3.0"
In mariadb 10.3 i have a table with fiel call geometry which is a multipolygon type.
i put my geojson file into storage folder with this contains :
{
"type" : "Feature",
"geometry" : {
"type" : "MultiPolygon",
"coordinates" : [
[
[
[ -0.1102826359, 46.0408417066 ],
[ -0.1105248307, 46.0396563022 ],
[ -0.1110213611, 46.0388036639 ],
[ -0.1129798062, 46.0362094235 ],
[ -0.1163671451, 46.03141209 ],
[ -0.1169999535, 46.0306611122 ],
[ -0.1223431941, 46.0274210917 ],
[ -0.127828108, 46.02738696 ],
[ -0.131955472, 46.0263239776 ],
[ -0.1327192268, 46.0260820678 ],
[ -0.1341111631, 46.0254217424 ],
[ -0.1364125327, 46.0221533793 ],
[ -0.1366312892, 46.0211352721 ],
[ -0.1364355706, 46.0196546077 ],
[ -0.137559152, 46.0144992523 ],
[ -0.1406447432, 46.0112045517 ],
[ -0.1435702916, 46.0073563523 ],
[ -0.1448192016, 46.0046802437 ],
[ -0.1457237111, 46.0025868528 ],
[ -0.1443122335, 46.0023953422 ],
[ -0.1424505442, 46.0019288232 ],
[ -0.1410560728, 46.0012420393 ],
[ -0.1391710932, 45.9993693344 ],
[ -0.1373867157, 45.9934546199 ],
[ -0.1368442472, 45.9886806546 ],
[ -0.1367820943, 45.9872278342 ],
[ -0.1338326656, 45.9874915555 ],
[ -0.1324892758, 45.9877161822 ],
[ -0.1309578675, 45.9886354109 ],
[ -0.1282863936, 45.9905603197 ],
[ -0.1268777522, 45.9925728562 ],
[ -0.1251428694, 45.9941248526 ],
[ -0.1234795172, 45.9954125981 ],
[ -0.1218545361, 45.9963297687 ],
[ -0.1190123082, 45.9975129571 ],
[ -0.1173794238, 45.9978823511 ],
[ -0.1135347376, 45.998948798 ],
[ -0.1140048709, 46.0020224567 ],
[ -0.1146495748, 46.0051634093 ],
[ -0.1137408096, 46.0057182993 ],
[ -0.109439723, 46.0066376261 ],
[ -0.1072318555, 46.0058547069 ],
[ -0.0989845556, 46.0055742078 ],
[ -0.0932577159, 46.0108323641 ],
[ -0.0856733123, 46.0115204658 ],
[ -0.0849251337, 46.0113020327 ],
[ -0.0843106562, 46.0113458021 ],
[ -0.0823215103, 46.0126156391 ],
[ -0.0786467339, 46.0150135781 ],
[ -0.076715267, 46.017573127 ],
[ -0.0757766731, 46.0199173397 ],
[ -0.0727775177, 46.0234925804 ],
[ -0.071824253, 46.0238888133 ],
[ -0.0719896303, 46.0246953855 ],
[ -0.0731574813, 46.0248051979 ],
[ -0.0737503565, 46.0265473059 ],
[ -0.0749919333, 46.0283213729 ],
[ -0.0773331769, 46.0301160334 ],
[ -0.0817461309, 46.0333205399 ],
[ -0.087177269, 46.0352688459 ],
[ -0.0893528382, 46.0371191573 ],
[ -0.0914526844, 46.0392769973 ],
[ -0.0950451816, 46.0397647084 ],
[ -0.0987452293, 46.0397717385 ],
[ -0.1074530256, 46.0397522898 ],
[ -0.1095303511, 46.0406740018 ],
[ -0.1102826359, 46.0408417066 ]
]
]
]
},
and in my controller i have add :
use Grimzy\LaravelMysqlSpatial\Types\Point;
use Grimzy\LaravelMysqlSpatial\Types\Polygon;
use Grimzy\LaravelMysqlSpatial\Eloquent;
$example = file_get_contents(storage_path('example.json'));
$data = json_decode($example, true);
$majsigadhe->geometry = DB::raw('MultiPolygonFromText(\'MULTIPOLYGON('.$wkt.'))');
But i have an error : SQLSTATE[42000]: Syntax error or access violation: 1064 Erreur de syntaxe près de ''MULTIPOLYGON([ [45.5672032582 -0.781746338], [45.5681200944 -0.7807820887], [45' à la ligne 1 (SQL: update
Can you help me please !
How can I add a custom key-value pair to a grok pattern?
For example, I would like to add a key-value pair of "city": [["New York]] to the data result, even though it doesn't exist in the log line.
How do I do this? Tyvm, Keith :^)
Complete, Minimal, and Verifiable Example
Data:
WARN 10/11/2017 kmiklas
Grok:
%{WORD:logLevel}\s%{DATE:date}\s%{USER:user}
{
"logLevel": [
[
"WARN"
]
],
"date": [
[
"10/11/2017"
]
],
"DATE_US": [
[
"10/11/2017"
]
],
"MONTHNUM": [
[
"10",
null
]
],
"MONTHDAY": [
[
"11",
null
]
],
"YEAR": [
[
"2017",
null
]
],
"DATE_EU": [
[
null
]
],
"user": [
[
"kmiklas"
]
],
"USERNAME": [
[
"kmiklas"
]
]
}
I understand that will be a fixed field, so you need to use the mutate method, like this:
mutate { add_field => { "city" => [["New York"]] } }
if you want the new field to be only in some logs you need to include if
if "some_test" in [message]{mutate.....}
I have following geojson polygon JSON that I'd like to import into rethinkDB. I attempted to use following r.geojson approach to import (refer to Building an earthquake map with RethinkDB and GeoJSON):
r.db("strongloop").table("region").insert(
r.http("91231cd2.ngrok.io/data/geojson/MP14_REGION_WEB_PL_FLAT.json")("features")
.merge(function(zone) {
return {
zone: r.geojson(zone("geometry"))
}
}))
This approach gives me following error:
RqlRuntimeError: Invalid LinearRing. Are there antipodal or duplicate vertices? Is it self-intersecting? in: r.db("strongloop").table("region").insert(r.http("91231cd2.ngrok.io/data/geojson/MP14_REGION_WEB_PL_FLAT.json")("features").merge(function(var_63) { return {zone: r.geojson(var_63("geometry"))}; }))
I suspect it is because the geojson comes from flattened multipolygon (done using geojson.io Meta feature since RethinkDB does not support multipolygon) - but visually, the polygon is what I expected. I've also attempted to use r.polygon approach as following:
r.db("strongloop").table("region").insert(
r.http("91231cd2.ngrok.io/data/geojson/MP14_REGION_WEB_PL_FLAT.json")("features")
.merge(function(zone) {
return {
zone: r.polygon(zone("geometry")("coordinates"))
}
}))
but RethinkDB expects me to give array of points
RqlCompileError: Expected 3 or more arguments but found 1 in: r.db("strongloop").table("region").insert(r.http("91231cd2.ngrok.io/data/geojson/MP14_REGION_WEB_PL_FLAT.json")("features").merge(function(var_64) { return {zone: r.polygon(var_64("geometry")("coordinates"))}; }))
I could not figure out how to extract array of geometry coordinates before passing to r.polygon using code above.
How should I resolve this? Is there any better way?
Check URL
What happens if you do the http request by itself? I tried it and g0t a 404 on that resource. I would run that command first and make sure it works:
r.http("91231cd2.ngrok.io/data/geojson/MP14_REGION_WEB_PL_FLAT.json")
Try r.args
r.polygon expects 3 arguments, but you're passing it one. You might try using r.args to spread those arguments in the function (similar to Function.apply, if you're a JavaScript guy)
r.db("strongloop").table("region").insert(
r.http("91231cd2.ngrok.io/data/geojson/MP14_REGION_WEB_PL_FLAT.json") ("features")
.merge(function(zone) {
return {
zone: r.polygon(r.args(zone("geometry")("coordinates")))
}
}))
Invalid Polygons
It seems that one of your polygons might be invalid. If you use the input from the other answer you posted and you use it the following function, it will work:
r.expr(ARRAY_FROM_OTHER_ANSWER_WITH_POLYGONS).do(function (arr) {
// Remove middle element
return arr.slice(0, 2).add(arr.slice(3, 5))
// Map all elements to polygons
// Make sure you pass an array of LON/LATs into `r.polygon`
.map(function (row) {
return r.polygon(r.args(row('geometry')('coordinates')(0)));
});
})
Perhaps you can insert them one by one and catch the ones that failed.
The folowing query fails:
r.json(r.http('https://gist.githubusercontent.com/tekoadjaib/9e0f0729c050b69b283f/raw/6950765ed4a931b9b208e69a3c39b3114be5c7e3/map.geojson'))('features')
.map(function (row) {
return r.polygon(r.args(row('geometry')('coordinates')(0)))
})
While this one (slicing the first 17 elements) doesn't.
r.json(r.http('https://gist.githubusercontent.com/tekoadjaib/9e0f0729c050b69b283f/raw/6950765ed4a931b9b208e69a3c39b3114be5c7e3/map.geojson'))('features')
.slice(0, 17)
.map(function (row) {
return r.polygon(r.args(row('geometry')('coordinates')(0)))
})
Running this command on RethinkDB Data Explorer
r.http("6f892736.ngrok.io/data/geojson/MP14_REGION_WEB_PL_FLAT.json") ("features")
I received (removed some to fit SO limit)
[
{
"geometry": {
"coordinates": [
[
[
103.84874965353661,
1.363027350968694
],
[
103.84924291873233,
1.362752820720889
],
[
103.84935645049902,
1.362682483934137
],
[
103.84973091592526,
1.362406260504349
],
[
103.84992386166968,
1.362263929416379
],
[
103.85137091514449,
1.361102941278631
],
[
103.85194295836556,
1.360652909851773
],
[
103.8522672818684,
1.360326981650605
],
[
103.82714577966834,
1.241938910658531
],
[
103.82714429349235,
1.241945678019855
]
]
],
"type": "Polygon"
},
"properties": {
"FMEL_UPD_D": "2014/12/05",
"INC_CRC": "F6D4903B6C0B72F8",
"OBJECTID": 1,
"REGION_C": "CR",
"REGION_N": "CENTRAL REGION",
"SHAPE_Area": 136405631.404,
"SHAPE_Leng": 131065.464453,
"X_ADDR": 27836.5573,
"Y_ADDR": 31929.9186
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
103.82233409716747,
1.247288081083765
],
[
103.82235533213682,
1.247267117084279
],
[
103.82236522405806,
1.247257351790808
],
[
103.82239090120945,
1.24726873242952
],
[
103.82242101348092,
1.247282079176339
],
[
103.82244356466394,
1.247292075218428
],
[
103.8224842992999,
1.247310126516275
],
[
103.82229812450149,
1.247323592638841
],
[
103.82233409716747,
1.247288081083765
]
]
],
"type": "Polygon"
},
"properties": {
"FMEL_UPD_D": "2014/12/05",
"INC_CRC": "F6D4903B6C0B72F8",
"OBJECTID": 1,
"REGION_C": "CR",
"REGION_N": "CENTRAL REGION",
"SHAPE_Area": 136405631.404,
"SHAPE_Leng": 131065.464453,
"X_ADDR": 27836.5573,
"Y_ADDR": 31929.9186
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
103.81270485670082,
1.253738883481215
],
[
103.81270819925057,
1.253736038375202
],
[
103.81271747666578,
1.25372269002029
],
[
103.81272796270179,
1.253696608214719
],
[
103.81272550089241,
1.25367617858827
],
[
103.81271663253291,
1.253660777180855
],
[
103.81268489667742,
1.253637281524639
],
[
103.81271738240808,
1.253596580832204
],
[
103.81272993138482,
1.25358085854482
],
[
103.81277884770714,
1.253527980705921
],
[
103.81280844732579,
1.253491732178708
],
[
103.81284783649771,
1.253444824881476
],
[
103.81289710415396,
1.253390129269173
],
[
103.81268859863616,
1.253749463519217
],
[
103.81269418659909,
1.253747966839359
],
[
103.81269933160983,
1.253743587040128
],
[
103.81270485670082,
1.253738883481215
]
]
],
"type": "Polygon"
},
"properties": {
"FMEL_UPD_D": "2014/12/05",
"INC_CRC": "F6D4903B6C0B72F8",
"OBJECTID": 1,
"REGION_C": "CR",
"REGION_N": "CENTRAL REGION",
"SHAPE_Area": 136405631.404,
"SHAPE_Leng": 131065.464453,
"X_ADDR": 27836.5573,
"Y_ADDR": 31929.9186
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
103.81422064298785,
1.252570070111331
],
[
103.81420878069888,
1.252558437176131
],
[
103.8142083125649,
1.252558523991746
],
[
103.81420773751474,
1.252557413427196
],
[
103.81419024508641,
1.252540259301697
],
[
103.81418525918728,
1.252535369363019
],
[
103.81417827319876,
1.252525659143691
],
[
103.81417483815903,
1.252520884975136
],
[
103.81417401960785,
1.25251974727783
],
[
103.8141688845694,
1.252512609990775
],
[
103.81416372167686,
1.252505434720186
],
[
103.81415922015667,
1.252490646509147
],
[
103.81415911592985,
1.252490302849641
],
[
103.81415883649417,
1.252489384917013
],
[
103.81415845013613,
1.252488116994314
],
[
103.8141580341274,
1.252486750495618
],
[
103.8141581823891,
1.252486131910979
],
[
103.81415836569447,
1.252485366819468
],
[
103.81415859033339,
1.252484429898899
],
[
103.81415863076748,
1.252484387394026
],
[
103.81415862268139,
1.252484294244369
],
[
103.81416084480966,
1.252475025422944
],
[
103.81416187994584,
1.25247070708728
],
[
103.81416579397985,
1.252464651487459
],
[
103.81417344413717,
1.25245281611786
],
[
103.81417638235824,
1.25244826989617
],
[
103.81418792868888,
1.252415206393471
],
[
103.81423209597757,
1.252398253489821
],
[
103.8142345678362,
1.252397304828964
],
[
103.81423924468973,
1.252395510602936
],
[
103.8142416716218,
1.252394579124685
],
[
103.81424197622378,
1.252394461559454
],
[
103.81424641316956,
1.252392758672508
],
[
103.81427168974326,
1.252383056828959
],
[
103.81429695645653,
1.252370091131469
],
[
103.81430622571014,
1.252365335143192
],
[
103.81430795807904,
1.252364492287584
],
[
103.81430790237042,
1.252364474199889
],
[
103.8143179156083,
1.252359335670564
],
[
103.81433202075975,
1.252352098139711
],
[
103.81434014977647,
1.252347926362841
],
[
103.81435231859189,
1.252341681810603
],
[
103.81435985727103,
1.252338114145249
],
[
103.81437420681739,
1.25233151509769
],
[
103.81439499523958,
1.252321955205564
],
[
103.81439606179633,
1.252321465047431
],
[
103.81439624419711,
1.252321532876141
],
[
103.81440192381508,
1.25231876917771
],
[
103.81441291824507,
1.252313712952395
],
[
103.81442976570837,
1.252305965378984
],
[
103.81444317808666,
1.252299726261537
],
[
103.81445277979405,
1.252295146626335
],
[
103.81447443170696,
1.252284820742596
],
[
103.8144961555022,
1.252274461397674
],
[
103.81450288101018,
1.252271253663335
],
[
103.81450281451966,
1.252271173174363
],
[
103.81452463535528,
1.252260878944195
],
[
103.81458959107665,
1.25223203649656
],
[
103.81461125376586,
1.252222416920872
],
[
103.81464389561143,
1.252207399268555
],
[
103.81465169486319,
1.252203810803814
],
[
103.81469601222396,
1.252183421305906
],
[
103.81472344798394,
1.252170002532816
],
[
103.81478302601083,
1.252140862505733
],
[
103.81484031637163,
1.252113379257888
],
[
103.81490026635718,
1.25208846442443
],
[
103.81491445851239,
1.252102786050432
],
[
103.81491771565472,
1.252106072536219
],
[
103.81491908860134,
1.25210674629792
],
[
103.81493128425387,
1.252117179139818
],
[
103.8149446623662,
1.2521281301912
],
[
103.81496569689162,
1.252131490055921
],
[
103.81497133065815,
1.25213238993891
],
[
103.81498839193847,
1.252128956184855
],
[
103.81500279627888,
1.252124305136556
],
[
103.8150235712083,
1.252116328782531
],
[
103.81502467283144,
1.252112382141001
],
[
103.8150250430265,
1.252112184992011
],
[
103.81502909456997,
1.252100774646097
],
[
103.81503503665392,
1.252084043029215
],
[
103.81503408874394,
1.252078647580404
],
[
103.81503511578735,
1.25207496772605
],
[
103.81503518952596,
1.252066416954603
],
[
103.81502759086356,
1.252038774077729
],
[
103.81502703827032,
1.252038532608371
],
[
103.81502617751417,
1.252033633656605
],
[
103.81501061513713,
1.252014397701631
],
[
103.81497715415199,
1.251984291152084
],
[
103.81496625504562,
1.251978257151349
],
[
103.8149622584071,
1.251976044141786
],
[
103.8149536020188,
1.251971250945737
],
[
103.8149359747586,
1.25196149181759
],
[
103.81491979321531,
1.251953915836878
],
[
103.8149053934479,
1.251947173693286
],
[
103.81487481213755,
1.251932856472991
],
[
103.81486042674678,
1.251926121564181
],
[
103.8148226958023,
1.251918231615303
],
[
103.8148209230086,
1.251917860813026
],
[
103.81482003795891,
1.251917765848395
],
[
103.8148186775897,
1.251917391431592
],
[
103.81480645223182,
1.251914834704565
],
[
103.81478684994318,
1.251914215075008
],
[
103.81478406270905,
1.25191412733175
],
[
103.81476586212422,
1.251913551121548
],
[
103.81475217215036,
1.251913118737449
],
[
103.81473641375817,
1.251913570807558
],
[
103.81469760451252,
1.25191528611085
],
[
103.81464911173373,
1.251930252101506
],
[
103.81464647993616,
1.251931415096138
],
[
103.81464604415146,
1.251931198949751
],
[
103.81463423207276,
1.251934844360703
],
[
103.81462343982588,
1.251938175059867
],
[
103.81461634052772,
1.251941862105349
],
[
103.81459325275814,
1.251953853820537
],
[
103.81457931114169,
1.251961094067155
],
[
103.81457055045844,
1.251965643864866
],
[
103.81450478872569,
1.251999797642535
],
[
103.81446223335465,
1.252023820888956
],
[
103.81441832030102,
1.2520486110264
],
[
103.8143689396795,
1.25207648681698
],
[
103.81429144309426,
1.252119919289534
],
[
103.81421839961543,
1.252163028029699
],
[
103.81418472441868,
1.252183801048487
],
[
103.81416549402833,
1.252195662559566
],
[
103.81411929141971,
1.252234061560852
],
[
103.81407773413764,
1.252281223893357
],
[
103.81405899059976,
1.252313446282806
],
[
103.81403917762307,
1.252371587767593
],
[
103.81403048853925,
1.252414490782956
],
[
103.81403453146623,
1.252476150424537
],
[
103.81404507986444,
1.252520744745098
],
[
103.81406615890175,
1.252581120314285
],
[
103.81410007800378,
1.252628997652677
],
[
103.81413071763996,
1.252654609498039
],
[
103.81415741467501,
1.252660750333722
],
[
103.81415875168324,
1.252661057827697
],
[
103.81415903202367,
1.252661122944038
],
[
103.81416270520218,
1.25266196764807
],
[
103.81416714302718,
1.252662988708921
],
[
103.81416796517983,
1.252663120752286
],
[
103.81420024580622,
1.252650676021723
],
[
103.8142128693197,
1.252638786426654
],
[
103.8142159252361,
1.252635907855009
],
[
103.81421741504606,
1.252629051874232
],
[
103.81422008102156,
1.252623340828278
],
[
103.81422398521352,
1.252611535275082
],
[
103.8142249584107,
1.252598998973394
],
[
103.81422552184074,
1.252591729690962
],
[
103.81422064298785,
1.252570070111331
]
]
],
"type": "Polygon"
},
"properties": {
"FMEL_UPD_D": "2014/12/05",
"INC_CRC": "F6D4903B6C0B72F8",
"OBJECTID": 1,
"REGION_C": "CR",
"REGION_N": "CENTRAL REGION",
"SHAPE_Area": 136405631.404,
"SHAPE_Leng": 131065.464453,
"X_ADDR": 27836.5573,
"Y_ADDR": 31929.9186
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
103.74130389714394,
1.159976941119677
],
[
103.7413428293003,
1.159968251449955
],
[
103.74129985127891,
1.159780169341412
],
[
103.74126091912512,
1.159788858106384
],
[
103.74130389714394,
1.159976941119677
]
]
],
"type": "Polygon"
},
"properties": {
"FMEL_UPD_D": "2014/12/05",
"INC_CRC": "11540153B663CA9B",
"OBJECTID": 5,
"REGION_C": "WR",
"REGION_N": "WEST REGION",
"SHAPE_Area": 257110296.977,
"SHAPE_Leng": 258264.026231,
"X_ADDR": 12896.436,
"Y_ADDR": 33986.5714
},
"type": "Feature"
}
]